diff --git a/bosh-release/src/sslip.io-dns-server/integration_test.go b/bosh-release/src/sslip.io-dns-server/integration_test.go index 7fd1aac..f42ca31 100644 --- a/bosh-release/src/sslip.io-dns-server/integration_test.go +++ b/bosh-release/src/sslip.io-dns-server/integration_test.go @@ -111,8 +111,8 @@ var _ = Describe("sslip.io-dns-server", func() { `TypeSRV example.com. \? nil, SOA example.com. briancunnie.gmail.com. 2022011900 900 900 1800 180\n$`), Entry(`TXT for version.status.sslip.io is the version number of the xip software (which gets overwritten during linking)`, "@127.0.0.1 version.status.sslip.io txt +short", - `\A"dev"\n"today"\n"xxx"\n\z`, - `TypeTXT version.status.sslip.io. \? \["dev"\], \["today"\], \["xxx"\]`), + `\A"0.0.0"\n"0001/01/01-99:99:99-0800"\n"cafexxx"\n\z`, + `TypeTXT version.status.sslip.io. \? \["0.0.0"\], \["0001/01/01-99:99:99-0800"\], \["cafexxx"\]`), Entry(`TXT is the querier's IPv4 address and the domain "ip.sslip.io"`, "@127.0.0.1 ip.sslip.io txt +short", `127.0.0.1`, diff --git a/bosh-release/src/sslip.io-dns-server/xip/xip.go b/bosh-release/src/sslip.io-dns-server/xip/xip.go index 9c95c73..146bff9 100644 --- a/bosh-release/src/sslip.io-dns-server/xip/xip.go +++ b/bosh-release/src/sslip.io-dns-server/xip/xip.go @@ -105,9 +105,9 @@ var ( dkim2, _ = dnsmessage.NewName("protonmail2.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.") dkim3, _ = dnsmessage.NewName("protonmail3.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.") - VersionSemantic = "dev" - VersionDate = "today" - VersionGitHash = "xxx" + VersionSemantic = "0.0.0" + VersionDate = "0001/01/01-99:99:99-0800" + VersionGitHash = "cafexxx" TxtKvCustomizations = KvCustomizations{} Customizations = DomainCustomizations{ @@ -748,7 +748,9 @@ func (x Xip) TXTResources(fqdn string) ([]dnsmessage.TXTResource, error) { if domain, ok := Customizations[strings.ToLower(fqdn)]; ok { // Customizations[strings.ToLower(fqdn)] returns a _function_, // we call that function, which has the same return signature as this method - return domain.TXT(x) + if domain.TXT != nil { + return domain.TXT(x) + } } return nil, nil } diff --git a/bosh-release/src/sslip.io-dns-server/xip/xip_test.go b/bosh-release/src/sslip.io-dns-server/xip/xip_test.go index 24ec379..638a437 100644 --- a/bosh-release/src/sslip.io-dns-server/xip/xip_test.go +++ b/bosh-release/src/sslip.io-dns-server/xip/xip_test.go @@ -161,6 +161,13 @@ var _ = Describe("Xip", func() { Expect(txts[0].TXT[0]).To(MatchRegexp("^1.1.1.1$")) }) }) + When(`a customized domain without a TXT entry is queried`, func() { + It("returns no records (and doesn't panic, either)", func() { + txts, err := x.TXTResources("ns.sslip.io.") + Expect(err).To(Not(HaveOccurred())) + Expect(len(txts)).To(Equal(0)) + }) + }) When(`the domain "k-v.io is queried"`, func() { txtTests := func() { DescribeTable(`the domain "k-v.io" is queried for TXT records`, diff --git a/spec/check-dns_spec.rb b/spec/check-dns_spec.rb index 8176cf6..7053157 100644 --- a/spec/check-dns_spec.rb +++ b/spec/check-dns_spec.rb @@ -109,19 +109,19 @@ describe domain do expect(`dig @#{whois_nameserver} TXT ip.#{domain} +short`).to match(/^"([0-9]+\.[0-9]+\.[0-9]+\.[0-9+])|(([0-9a-fA-F]*:){2,7}[0-9a-fA-F]*)"$/) end - it "sets a key-value @#{whois_nameserver} sslipio-spec.kv.sslip.io" do + it "sets a key-value @#{whois_nameserver} sslipio-spec.k-v.io" do expect(`dig @#{whois_nameserver} put.MyKey.sslipio-spec.kv.#{domain} TXT +short`).to match(/^"MyKey"$/) end - it "gets a key-value @#{whois_nameserver} sslipio-spec.kv.sslip.io" do + it "gets a key-value @#{whois_nameserver} sslipio-spec.k-v.io" do expect(`dig @#{whois_nameserver} sslipio-spec.kv.#{domain} TXT +short`).to match(/^"MyKey"$/) end - it "deletes a key-value @#{whois_nameserver} sslipio-spec.kv.sslip.io" do + it "deletes a key-value @#{whois_nameserver} sslipio-spec.k-v.io" do expect(`dig @#{whois_nameserver} delete.sslipio-spec.kv.#{domain} TXT +short`).to match(/^"MyKey"$/) end - it "gets a key-value @#{whois_nameserver} sslipio-spec.kv.sslip.io" do + it "gets a key-value @#{whois_nameserver} sslipio-spec.k-v.io" do expect(`dig @#{whois_nameserver} sslipio-spec.kv.#{domain} TXT +short`).to match(/^$/) end end