mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 10:43:17 -04:00
Add notifies to master servers
This adds a bunch of supporting code to send notifies to a primary name server.
This commit is contained in:
@@ -7,12 +7,15 @@ import (
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
// Host represents a host from the Caddyfile, may contain port.
|
||||
type Host string
|
||||
// Host represents a host from the Corefile, may contain port.
|
||||
type (
|
||||
Host string
|
||||
Addr string
|
||||
)
|
||||
|
||||
// Standard host will return the host portion of host, stripping
|
||||
// Standard will return the host portion of host, stripping
|
||||
// of any port. The host will also be fully qualified and lowercased.
|
||||
func (h Host) StandardHost() string {
|
||||
func (h Host) Standard() string {
|
||||
// separate host and port
|
||||
host, _, err := net.SplitHostPort(string(h))
|
||||
if err != nil {
|
||||
@@ -20,3 +23,14 @@ func (h Host) StandardHost() string {
|
||||
}
|
||||
return strings.ToLower(dns.Fqdn(host))
|
||||
}
|
||||
|
||||
// Standard will return a normalized address, if not port is specified
|
||||
// port 53 is added, otherwise the port will be left as is.
|
||||
func (a Addr) Standard() string {
|
||||
// separate host and port
|
||||
addr, port, err := net.SplitHostPort(string(a))
|
||||
if err != nil {
|
||||
addr, port, _ = net.SplitHostPort(string(a) + ":53")
|
||||
}
|
||||
return net.JoinHostPort(addr, port)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user