mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-30 02:21:47 +08:00
e215c4fda4fdcf36b8b4a14b740f5edb0554b5d7
panic() invoking a customized TXT
We made a mistake: we blindly invoked a function that was sometimes `nil`. Specifically, if we had a customized domain (e.g. `ns.sslip.io`) that didn't have a TXT record (a function), we'd try to invoke it anyway. Bad move. Now we ensure the function is there before we try to invoke it. This is a curious affirmation of installing metrics: if we hadn't seen that the server had been restarted because uptime was too low, we wouldn't have caught this bug. Drive-by: we made the lengths of TXT records of `version.status.sslip.io` exactly match what we replace them with during the linking phase. We hope that this fixes the wrong-line-numbers we see in the `panic()` messages. [fixes #14]
sslip.io
| Test Type | Status |
|---|---|
| Production Nameservers | |
| DNS Server Unit Tests |
sslip.io is a DNS server that maps specially-crafted DNS A records to IP addresses (e.g. "127-0-0-1.sslip.io" maps to 127.0.0.1). It is similar to, and inspired by, xip.io.
If you'd like to use sslip.io as a service, refer to the website (sslip.io) for more information. This README targets developers; the website targets users.
src/contains the source code to the DNS server.ci/contains the Concourse continuous integration (CI) pipeline and task.spec/contains the tests for the production nameservers. To run the tests locally:DOMAIN=sslip.io rspec --format documentation --color spec/k8s/document_root/contains the HTML content of the sslip.io website. Please runtidy -im -w 120 k8s/document_root/index.htmlbefore submitting pull requests.bosh-release/contains the BOSH release. BOSH is the mechanism we use to deploy the servers, and the sslip.io BOSH release is a packaging of the DNS server (analogous to a.msi,.pkg,.debor.rpm)
DNS Server
The DNS server is written in Golang and is not configurable without modifying the source:
- it binds to port 53 (you can't change it)
- it only binds to UDP (no TCP, sorry)
- The SOA record is hard-coded with the exception of the MNAME (primary master
name server) record, which is set to the queried hostname (e.g.
dig big.apple.com @ns-aws.nono.iowould return an SOA with an MNAME record ofbig.apple.com. - The NS records are hard-coded
- The MX records are hard-coded to the queried hostname with a preference of 0,
with the exception of
sslip.ioitself, which has custom MX records to enable email delivery to ProtonMail. - No TXT records are returned with the exception of
sslip.io, which has custom records to enable email delivery - There are no SRV records
To run the unit tests:
cd src
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...
ginkgo -r .
To run the server on, say, a Mac, you must first start the server:
cd src
go run main.go
And then, in another window, run a query, e.g.:
dig +short 127.0.0.1.sslip.io @localhost
Which will return the expected IP address:
127.0.0.1
You will also see a log message in the server window, similar to the following:
2020/11/22 03:45:44 ::1.62302 TypeA 127.0.0.1.sslip.io. ? 127.0.0.1
Acknowledgements
- Sam Stephenson (xip.io), Roopinder Singh (nip.io), and the other DNS developers out there
- The contributors (@normanr, @jpambrun come to mind) who improved sslip.io
- Jenessa Petersen of Let's Encrypt who bumped the rate limits
- Natalia Ershova of JetBrains who provided a free license for open source development
Description
Languages
Go
80.9%
HTML
14.2%
Ruby
2.7%
Dockerfile
1.8%
Shell
0.4%