Implement zone lookup with MDNSCLient
This separates Zone into the DB ops and the Lookup ops, and implements the latter for MDNSClient so it can be used just like the zonedb. A notable change is that Lookup methods only ever return one result, while MDNSClient.SendQuery could in theory return multiple results (though it wouldn't, because no server would supply more than one result in a response, and it stops waiting after getting one response ..). ReverseLookupLocal is implemented even though no MDNSServer will answer at present (hence no test yet). Lastly, the handler (creating) functions can now be given a list of Lookup implementations to try in order.
This commit is contained in:
1 parent
3866bd5e63
commit
bf752d2d1f
4 files changed
+85
-41
No files matched your search
+6
-2
@@ -14,12 +14,16 @@ const (
|
||||
// +1 to also exclude a dot
|
||||
var rdnsDomainLen = len(RDNS_DOMAIN) + 1
|
||||
|
||||
type Lookup interface {
|
||||
LookupLocal(name string) (net.IP, error)
|
||||
ReverseLookupLocal(inaddr string) (string, error)
|
||||
}
|
||||
|
||||
type Zone interface {
|
||||
AddRecord(ident string, name string, ip net.IP) error
|
||||
DeleteRecord(ident string, ip net.IP) error
|
||||
DeleteRecordsFor(ident string) error
|
||||
LookupLocal(name string) (net.IP, error)
|
||||
ReverseLookupLocal(inaddr string) (string, error)
|
||||
Lookup
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
|
||||
Reference in new issue
Block a user