simplify hardcoded records
This commit is contained in:
parent
9d3ce15f74
commit
e031244f2b
41
xip/xip.go
41
xip/xip.go
@ -18,11 +18,11 @@ type Xip struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HardcodedRecord struct {
|
type HardcodedRecord struct {
|
||||||
A []*dns.A
|
A []net.IP // => dns.A
|
||||||
AAAA []*dns.AAAA
|
AAAA []net.IP // => dns.AAAA
|
||||||
TXT []string // *dns.TXT
|
TXT []string // => dns.TXT
|
||||||
MX []*dns.MX
|
MX []*dns.MX
|
||||||
CNAME []*dns.CNAME
|
CNAME []string // => dns.CNAME
|
||||||
SRV *dns.SRV
|
SRV *dns.SRV
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,25 +38,24 @@ var (
|
|||||||
hardcodedRecords = map[string]HardcodedRecord{
|
hardcodedRecords = map[string]HardcodedRecord{
|
||||||
"ns.local-ip.sh.": {
|
"ns.local-ip.sh.": {
|
||||||
// record holding ip addresses of ns1 and ns2
|
// record holding ip addresses of ns1 and ns2
|
||||||
A: []*dns.A{
|
A: []net.IP{
|
||||||
{A: net.IPv4(137, 66, 40, 11)},
|
net.IPv4(137, 66, 40, 11),
|
||||||
{A: net.IPv4(137, 66, 40, 12)},
|
net.IPv4(137, 66, 40, 12),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ns1.local-ip.sh.": {
|
"ns1.local-ip.sh.": {
|
||||||
A: []*dns.A{
|
A: []net.IP{
|
||||||
{A: net.IPv4(137, 66, 40, 11)}, // fly.io edge-only ip address, see https://community.fly.io/t/custom-domains-certificate-is-stuck-on-awaiting-configuration/8329
|
net.IPv4(137, 66, 40, 11), // fly.io edge-only ip address, see https://community.fly.io/t/custom-domains-certificate-is-stuck-on-awaiting-configuration/8329
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ns2.local-ip.sh.": {
|
"ns2.local-ip.sh.": {
|
||||||
A: []*dns.A{
|
A: []net.IP{
|
||||||
{A: net.IPv4(137, 66, 40, 12)}, // fly.io edge-only ip address #2
|
net.IPv4(137, 66, 40, 12), // fly.io edge-only ip address #2
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"local-ip.sh.": {
|
"local-ip.sh.": {
|
||||||
A: []*dns.A{
|
A: []net.IP{
|
||||||
// {A: net.IPv4(66, 241, 125, 48)},
|
net.IPv4(137, 66, 40, 11), // fly.io edge-only ip address
|
||||||
{A: net.IPv4(137, 66, 40, 11)}, // fly.io edge-only ip address
|
|
||||||
},
|
},
|
||||||
TXT: []string{"v=spf1 include:capsulecorp.dev ~all"},
|
TXT: []string{"v=spf1 include:capsulecorp.dev ~all"},
|
||||||
MX: []*dns.MX{
|
MX: []*dns.MX{
|
||||||
@ -64,8 +63,8 @@ var (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"autodiscover.local-ip.sh.": {
|
"autodiscover.local-ip.sh.": {
|
||||||
CNAME: []*dns.CNAME{
|
CNAME: []string{
|
||||||
{Target: "email.capsulecorp.dev."},
|
"email.capsulecorp.dev.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"_autodiscover._tcp.local-ip.sh.": {
|
"_autodiscover._tcp.local-ip.sh.": {
|
||||||
@ -77,8 +76,8 @@ var (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"autoconfig.local-ip.sh.": {
|
"autoconfig.local-ip.sh.": {
|
||||||
CNAME: []*dns.CNAME{
|
CNAME: []string{
|
||||||
{Target: "email.capsulecorp.dev."},
|
"email.capsulecorp.dev.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"_dmarc.local-ip.sh.": {
|
"_dmarc.local-ip.sh.": {
|
||||||
@ -135,7 +134,7 @@ func (xip *Xip) fqdnToA(fqdn string) []*dns.A {
|
|||||||
Rrtype: dns.TypeA,
|
Rrtype: dns.TypeA,
|
||||||
Class: dns.ClassINET,
|
Class: dns.ClassINET,
|
||||||
},
|
},
|
||||||
A: record.A,
|
A: record,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +201,7 @@ func (xip *Xip) handleAAAA(question dns.Question, message *dns.Msg) {
|
|||||||
Rrtype: dns.TypeAAAA,
|
Rrtype: dns.TypeAAAA,
|
||||||
Class: dns.ClassINET,
|
Class: dns.ClassINET,
|
||||||
},
|
},
|
||||||
AAAA: record.AAAA,
|
AAAA: record,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,7 +299,7 @@ func (xip *Xip) handleCNAME(question dns.Question, message *dns.Msg) {
|
|||||||
Rrtype: dns.TypeCNAME,
|
Rrtype: dns.TypeCNAME,
|
||||||
Class: dns.ClassINET,
|
Class: dns.ClassINET,
|
||||||
},
|
},
|
||||||
Target: record.Target,
|
Target: record,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user