From 57976fcfb5c9c199bc3d4204bfc5e44c6f6ac670 Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Tue, 12 Jul 2022 06:30:01 -0700 Subject: [PATCH] PTR for IPv4 is hyphen-, not dot-, separated I prefer "192-168-0-1.sslip.io" over "192.168.0.1.sslip.io". It's marginally faster, and it follows the convention set for IPv6 addrs. --- src/sslip.io-dns-server/integration_test.go | 6 +++--- src/sslip.io-dns-server/xip/xip.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sslip.io-dns-server/integration_test.go b/src/sslip.io-dns-server/integration_test.go index e8a7e36..74c1256 100644 --- a/src/sslip.io-dns-server/integration_test.go +++ b/src/sslip.io-dns-server/integration_test.go @@ -173,10 +173,10 @@ var _ = Describe("sslip.io-dns-server", func() { "@127.0.0.1 get._acme-challenge.a.b.c.subdomain-key.k-v.io txt +short", `baffled-boy._acme-challenge`, `TypeTXT get._acme-challenge.a.b.c.subdomain-key.k-v.io. \? \["baffled-boy._acme-challenge"\]`), - Entry(`get a PTR for 1.0.168.192.in-addr.arpa returns 192.168.0.1.sslip.io`, + Entry(`get a PTR for 1.0.168.192.in-addr.arpa returns 192-168-0-1.sslip.io`, "@127.0.0.1 1.0.168.192.in-addr.arpa ptr +short", - `\A192.168.0.1.sslip.io.\n\z`, - `TypePTR 1.0.168.192.in-addr.arpa. \? 192.168.0.1.sslip.io.`), + `\A192-168-0-1.sslip.io.\n\z`, + `TypePTR 1.0.168.192.in-addr.arpa. \? 192-168-0-1.sslip.io.`), Entry(`get a PTR for 1.0.0.127.blah.in-addr.arpa returns no records`, "@127.0.0.1 1.0.0.127.blah.in-addr.arpa ptr +short", `\A\z`, diff --git a/src/sslip.io-dns-server/xip/xip.go b/src/sslip.io-dns-server/xip/xip.go index 64cee33..7fb9d0f 100644 --- a/src/sslip.io-dns-server/xip/xip.go +++ b/src/sslip.io-dns-server/xip/xip.go @@ -856,7 +856,7 @@ func (x *Xip) PTRResource(fqdn []byte) *dnsmessage.PTRResource { reversedIPv4address[1], reversedIPv4address[0], }) - ptrName, err := dnsmessage.NewName(ip.String() + ".sslip.io.") + ptrName, err := dnsmessage.NewName(strings.ReplaceAll(ip.String(), ".", "-") + ".sslip.io.") if err != nil { return nil }