tweaks
This commit is contained in:
parent
7adc5ab95b
commit
f111fe57a1
15
zone.go
15
zone.go
|
@ -12,8 +12,7 @@ type Zone struct {
|
||||||
*radix.Radix // Zone data
|
*radix.Radix // Zone data
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZoneData holds all the RR belonging to Name.
|
// ZoneData holds all the RRs having their ownername equal to Name.
|
||||||
// TODO(mg): uitbreiden
|
|
||||||
type ZoneData struct {
|
type ZoneData struct {
|
||||||
Name string // Domain name for this node
|
Name string // Domain name for this node
|
||||||
RR map[uint16][]RR // Map of the RR type to the RR
|
RR map[uint16][]RR // Map of the RR type to the RR
|
||||||
|
@ -23,7 +22,7 @@ type ZoneData struct {
|
||||||
Authoritatve bool
|
Authoritatve bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New ...
|
// NewZone creates an initialized zone with Origin set origin.
|
||||||
func NewZone(origin string) *Zone {
|
func NewZone(origin string) *Zone {
|
||||||
if origin == "" {
|
if origin == "" {
|
||||||
origin = "."
|
origin = "."
|
||||||
|
@ -37,13 +36,11 @@ func NewZone(origin string) *Zone {
|
||||||
return z
|
return z
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert inserts an RR into the zone. Overwrites.
|
// Insert inserts an RR into the zone. Duplicate data overwrites the
|
||||||
// Out-of-zone data
|
// old data.
|
||||||
// Glue
|
func (z *Zone) Insert(r RR) error {
|
||||||
func (z *Zone) Insert(r RR) {
|
|
||||||
if !IsSubDomain(r.Header().Name, z.Origin) {
|
if !IsSubDomain(r.Header().Name, z.Origin) {
|
||||||
println("Out of zone data", z.Origin, r.String())
|
return &Error{Err: "out of zone data", Name: r.Header().Name}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zd := z.Radix.Find(r.Header().Name)
|
zd := z.Radix.Find(r.Header().Name)
|
||||||
|
|
Loading…
Reference in New Issue