Lookup Any Public WHOIS with this nginx-based Server
After I set up a DN42 WHOIS server with Nginx, I configured my DN42 Looking Glass to use this service. As my Looking Glass is capable of running as a Telegram bot, fellow group members are looking up WHOIS information of IPs and domains with it.But soon we noticed a problem. A significant part of members have applied for ASNs and IP ranges on the public Internet after they're familiar enough with DN42, and they're peering at Internet Exchange Points. Therefore, they often need to lookup some public Internet IPs, ASNs, and domains, yet none of the Telegram bots in our group can do so. It would be quite helpful for us if there exists a WHOIS server that proxies lookups to relevant registries.Proxying is exactly what Nginx is good at. With some modifications to Nginx,...
Setting up DN42 WHOIS Server with Nginx
In my previous post, "Setting up Gopher Site with Nginx", I mentioned that the Gopher service is a byproduct of my original plan: modifying Nginx into a WHOIS server for DN42. This post will explore into details of that process.The WHOIS ProtocolFirst, we can find a WHOIS server to observe its response. Choose the WHOIS server for .pub domain as an example, and run telnet whois.nic.pub 43:# Type following line and hit enterlantian.pub# WHOIS server responded with:Domain Name: lantian.pubRegistry Domain ID: c69e5ccf9d834900be26f88fddc5c9e4-DONUTSRegistrar WHOIS Server: whois.dnspod.cnRegistrar URL: https://www.dnspod.cnUpdated Date: 2021-01-07T14:09:11ZCreation Date: 2016-10-23T08:36:41ZRegistry Expiry Date: 2029-10-23T08:36:41ZRegistrar: DNSPod, Inc....

Setting up Gopher Site with Nginx
Changelog2021-03-24: Improve post-processing, add scripts for parsing links and images.2021-03-21: Initial version.What's GopherGopher is a protocol born in the early ages of the Internet. It was invented at the University of Minnesota in 1991, with a purpose similar to HTTP today. The protocol itself is extremely simple:Client connects to TCP port 70 of the server, and send one line of URL ending with CRLF, e.g. some_dir/hello.txtServer sends data of the requested file and closes the connection.And we're done.The server could be returning a text file, a picture, a binary file, or a Gopher list file called Gophermap with special formatting. Each line of the file is composed of the following fields:A character representing the type of this line, may it be text (i), a link to a text file (0)...