mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-05 15:46:50 +08:00
Resolve hexadecimal notation for IPv4 addresses
e.g. `7f000001.sslip.io` → 127.0.0.1 This came about as a result of the nip.io migration to sslip.io servers: nip.io supported hexadecimal notation; sslip.io didn't. Several nip.io users were blindsided by the feature's lack, and raised an issue. - The hexadecimal-notated IPv4 must be exactly 8 hexadecimal characters, no separators. - Any hexadecimal notation _must_ be bookended by dots or by the beginning or end of the string (www.0a09091e.sslip.io or 0a09091e.sslip.io). No dashes. - If a normal IP notation and a hex notation are in the same hostname, then the normal IP notation takes precedence. This preserves existing behavior for sslip.io users, e.g. (0a09091e.127-0-0-1.sslip.io resolves to 127.0.0.1, not 10.9.9.30) [#92]
This commit is contained in:
@@ -136,6 +136,22 @@ var _ = Describe("flags", func() {
|
||||
Eventually(digSession, 1).Should(Exit(0))
|
||||
Eventually(string(serverSession.Err.Contents())).Should(MatchRegexp(`\? nil, SOA 8-8-8-8\.sslip\.io\. briancunnie\.gmail\.com\.`))
|
||||
})
|
||||
It("doesn't resolve public IPv4 addresses (hexadecimal)", func() {
|
||||
digArgs := "@localhost 08080808.sslip.io -p " + strconv.Itoa(port)
|
||||
digCmd := exec.Command("dig", strings.Split(digArgs, " ")...)
|
||||
digSession, err := Start(digCmd, GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Eventually(digSession, 1).Should(Exit(0))
|
||||
Eventually(string(serverSession.Err.Contents())).Should(MatchRegexp(`\? nil, SOA 08080808\.sslip\.io\. briancunnie\.gmail\.com\.`))
|
||||
})
|
||||
It("resolves private IPv4 addresses (hexadecimal)", func() {
|
||||
digArgs := "@localhost 7f000001.sslip.io -p " + strconv.Itoa(port)
|
||||
digCmd := exec.Command("dig", strings.Split(digArgs, " ")...)
|
||||
digSession, err := Start(digCmd, GinkgoWriter, GinkgoWriter)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Eventually(digSession, 1).Should(Exit(0))
|
||||
Eventually(string(serverSession.Err.Contents())).Should(MatchRegexp(`TypeA 7f000001.sslip.io. \? 127.0.0.1`))
|
||||
})
|
||||
It("doesn't resolve public IPv6 addresses", func() {
|
||||
digArgs := "@localhost aaaa 2600--.sslip.io -p " + strconv.Itoa(port)
|
||||
digCmd := exec.Command("dig", strings.Split(digArgs, " ")...)
|
||||
|
Reference in New Issue
Block a user