Documentation ¶
Index ¶
- Constants
- func LinkLocalMulticastListener(ifi *net.Interface) (net.PacketConn, error)
- func ListenHTTP(version string, server *DNSServer, domain string, db Zone, port int)
- type Cache
- func (c *Cache) Clear()
- func (c *Cache) Get(request *dns.Msg, maxLen int, now time.Time) (reply *dns.Msg, err error)
- func (c *Cache) Len() int
- func (c *Cache) Purge(now time.Time)
- func (c *Cache) Put(request *dns.Msg, reply *dns.Msg, ttl int, flags uint8, now time.Time) int
- func (c *Cache) Remove(question *dns.Question)
- type DNSServer
- type DNSServerConfig
- type DuplicateError
- type Lookup
- type LookupError
- type LookupFunc
- type MDNSAction
- type MDNSClient
- func (client *MDNSClient) LookupInaddr(inaddr string) (string, error)
- func (client *MDNSClient) LookupName(name string) (net.IP, error)
- func (c *MDNSClient) ResponseCallback(r *dns.Msg)
- func (c *MDNSClient) SendQuery(name string, querytype uint16, responseCh chan<- *Response)
- func (c *MDNSClient) Start(ifi *net.Interface) error
- type MDNSServer
- type Record
- type Response
- type Zone
- type ZoneDb
- func (zone *ZoneDb) AddRecord(ident string, name string, ip net.IP) error
- func (zone *ZoneDb) ContainerDied(ident string) error
- func (zone *ZoneDb) DeleteRecord(ident string, ip net.IP) error
- func (zone *ZoneDb) DeleteRecordsFor(ident string) error
- func (zone *ZoneDb) LookupInaddr(inaddr string) (string, error)
- func (zone *ZoneDb) LookupName(name string) (net.IP, error)
- func (zone *ZoneDb) String() string
Constants ¶
View Source
const ( MaxDuration = time.Duration(math.MaxInt64) MailboxSize = 16 )
View Source
const ( DefaultLocalDomain = "weave.local." // The default name used for the local domain DefaultServerPort = 53 // The default server port DefaultCLICfgFile = "/etc/resolv.conf" // default "resolv.conf" file to try to load DefaultUDPBuflen = 4096 // bigger than the default 512 DefaultCacheLen = 8192 // default cache capacity DefaultResolvWorkers = 8 // default number of resolution workers DefaultTimeout = 5 // default timeout for DNS resolutions )
View Source
const (
CacheNoLocalReplies uint8 = 1 << iota // not found in local network (stored in the cache so we skip another local lookup or some time)
)
View Source
const (
RDNSDomain = "in-addr.arpa."
)
Variables ¶
This section is empty.
Functions ¶
func LinkLocalMulticastListener ¶
func LinkLocalMulticastListener(ifi *net.Interface) (net.PacketConn, error)
Types ¶
type Cache ¶ added in v0.10.0
type Cache struct { Capacity int // contains filtered or unexported fields }
Cache is a thread-safe fixed capacity LRU cache.
func (*Cache) Clear ¶ added in v0.10.0
func (c *Cache) Clear()
Clear removes all the entries in the cache
func (*Cache) Get ¶ added in v0.10.0
Look up for a question's reply from the cache. If no reply is stored in the cache, it returns a `nil` reply and no error. The caller can then `Wait()` for another goroutine `Put`ing a reply in the cache.
type DNSServer ¶ added in v0.10.0
type DNSServer struct { Zone Zone Iface *net.Interface Upstream *dns.ClientConfig Domain string // the local domain ListenAddr string // the address the server is listening at // contains filtered or unexported fields }
func NewDNSServer ¶ added in v0.10.0
func NewDNSServer(config DNSServerConfig, zone Zone, iface *net.Interface) (s *DNSServer, err error)
Creates a new DNS server
type DNSServerConfig ¶ added in v0.10.0
type DNSServerConfig struct { // (Optional) client config file for resolving upstream servers UpstreamCfgFile string // (Optional) DNS client config for the fallback server(s) UpstreamCfg *dns.ClientConfig // (Optional) port number (for TCP and UDP) Port int // (Optional) local domain (ie, "weave.local.") LocalDomain string // (Optional) cache size CacheLen int // (Optional) timeout for DNS queries Timeout int // (Optional) UDP buffer length UDPBufLen int }
type DuplicateError ¶
type DuplicateError struct { }
func (DuplicateError) Error ¶
func (dup DuplicateError) Error() string
type LookupError ¶
type LookupError string
func (LookupError) Error ¶
func (ops LookupError) Error() string
type MDNSAction ¶ added in v0.10.0
type MDNSAction func()
type MDNSClient ¶
type MDNSClient struct {
// contains filtered or unexported fields
}
func NewMDNSClient ¶
func NewMDNSClient() (*MDNSClient, error)
func (*MDNSClient) LookupInaddr ¶ added in v0.9.0
func (client *MDNSClient) LookupInaddr(inaddr string) (string, error)
func (*MDNSClient) LookupName ¶ added in v0.9.0
func (client *MDNSClient) LookupName(name string) (net.IP, error)
func (*MDNSClient) ResponseCallback ¶
func (c *MDNSClient) ResponseCallback(r *dns.Msg)
Async - called from dns library multiplexer
type MDNSServer ¶
type MDNSServer struct {
// contains filtered or unexported fields
}
func NewMDNSServer ¶
func NewMDNSServer(zone Zone) (*MDNSServer, error)
func (*MDNSServer) Stop ¶ added in v0.10.0
func (s *MDNSServer) Stop() error
type ZoneDb ¶
type ZoneDb struct {
// contains filtered or unexported fields
}
Very simple data structure for now, with linear searching. TODO: make more sophisticated to improve performance.
func (*ZoneDb) ContainerDied ¶ added in v0.10.0
func (*ZoneDb) DeleteRecordsFor ¶
func (*ZoneDb) LookupInaddr ¶ added in v0.9.0
func (*ZoneDb) LookupName ¶ added in v0.9.0
Click to show internal directories.
Click to hide internal directories.