Prepare the use of multiple domains
This commit is contained in:
parent
e44233b9a3
commit
dd29c8ce92
3 changed files with 27 additions and 18 deletions
|
|
@ -236,7 +236,7 @@ func GetAssociatedDomain(student *adlin.Student, dn string) (rrs []Entry, err er
|
|||
err = errors.New(fmt.Sprintf("Unable to find domain %q.", dn))
|
||||
}
|
||||
|
||||
if entries, errr := parseZoneRead(adlin.AssociatedDomainSuffix, dn); err != nil {
|
||||
if entries, errr := parseZoneRead(student.MyAssociatedDomainSuffix(), dn); err != nil {
|
||||
return nil, errr
|
||||
} else {
|
||||
for _, e := range entries {
|
||||
|
|
@ -260,7 +260,7 @@ func delAssociatedDomains(student *adlin.Student, dn string) (err error) {
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.AssociatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyAssociatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
var rrs []dns.RR
|
||||
for _, domain := range adomains {
|
||||
|
|
@ -302,7 +302,7 @@ func AddAssociatedDomains(student *adlin.Student, aaaa net.IP) (err error) {
|
|||
m2.Id = dns.Id()
|
||||
m2.Opcode = dns.OpcodeUpdate
|
||||
m2.Question = make([]dns.Question, 1)
|
||||
m2.Question[0] = dns.Question{Name: adlin.AssociatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m2.Question[0] = dns.Question{Name: student.MyAssociatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
rrA := new(dns.A)
|
||||
rrA.Hdr = dns.RR_Header{Name: student.DefaultAssociatedDomain(), Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 3600}
|
||||
|
|
@ -335,7 +335,7 @@ func getRRDelegatedDomain(student *adlin.Student, dn string, rr string) (rrs []E
|
|||
err = errors.New(fmt.Sprintf("Unable to find domain %q.", dn))
|
||||
}
|
||||
|
||||
if entries, errr := parseZoneRead(adlin.DelegatedDomainSuffix, dn); err != nil {
|
||||
if entries, errr := parseZoneRead(student.MyDelegatedDomainSuffix(), dn); err != nil {
|
||||
return nil, errr
|
||||
} else {
|
||||
for _, e := range entries {
|
||||
|
|
@ -354,7 +354,7 @@ func AddNSDelegatedDomain(student *adlin.Student, dn string, ttl uint32, ns stri
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
rrNS := new(dns.NS)
|
||||
rrNS.Hdr = dns.RR_Header{Name: d, Rrtype: dns.TypeNS, Class: dns.ClassINET, Ttl: ttl}
|
||||
|
|
@ -377,7 +377,7 @@ func UpdateNSDelegatedDomain(student *adlin.Student, dn string, ttl uint32, oldn
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
rrOldNS := new(dns.NS)
|
||||
rrOldNS.Hdr = dns.RR_Header{Name: d, Rrtype: dns.TypeNS, Class: dns.ClassINET}
|
||||
|
|
@ -417,7 +417,7 @@ func AddGLUEDelegatedDomain(student *adlin.Student, dn string, ttl uint32, aaaa
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
var rr dns.RR
|
||||
rr, err = dns.NewRR(fmt.Sprintf("%s %d IN AAAA %s", dn, ttl, aaaa))
|
||||
|
|
@ -453,7 +453,7 @@ func UpdateGLUEDelegatedDomain(student *adlin.Student, dn string, ttl uint32, ol
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
var rr dns.RR
|
||||
|
||||
|
|
@ -509,7 +509,7 @@ func AddDSDelegatedDomain(student *adlin.Student, dn string, ttl uint32, rdata s
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
var ds *dns.DS
|
||||
ds = dnskey.ToDS(dns.SHA256)
|
||||
|
|
@ -545,7 +545,7 @@ func DeleteRRDelegatedDomain(student *adlin.Student, dn string, rr string, value
|
|||
m1.Id = dns.Id()
|
||||
m1.Opcode = dns.OpcodeUpdate
|
||||
m1.Question = make([]dns.Question, 1)
|
||||
m1.Question[0] = dns.Question{Name: adlin.DelegatedDomainSuffix, Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
m1.Question[0] = dns.Question{Name: student.MyDelegatedDomainSuffix(), Qtype: dns.TypeSOA, Qclass: dns.ClassINET}
|
||||
|
||||
rrr, errr := dns.NewRR(fmt.Sprintf("%s %s %s", dn, rr, strings.Join(values, " ")))
|
||||
if errr != nil {
|
||||
|
|
|
|||
Reference in a new issue