Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DomainRegistry ¶
type DomainRegistry struct {
// contains filtered or unexported fields
}
DomainRegistry is a thread-safe domain to address map, it also handles creation of domains through getDomain method
func NewDomainRegistry ¶
func NewDomainRegistry(logger *log.Logger, domainSuffix string) *DomainRegistry
NewDomainRegistry creates new registry using provided domainSuffix for domain creation
func (*DomainRegistry) AddRecord ¶
func (r *DomainRegistry) AddRecord(c container.Container)
AddRecord constructs a domain and adds a domain record for it, blocks until all current reads are done
func (*DomainRegistry) HandleEvent ¶
func (r *DomainRegistry) HandleEvent(event container.Event)
HandleEvent translates container events into appropriate actions e.g. adding or removing domain record for container
func (*DomainRegistry) RemoveRecord ¶
func (r *DomainRegistry) RemoveRecord(c container.Container)
RemoveRecord constructs a domain and removes corresponding domain record, blocks until all current reads are done
func (*DomainRegistry) ResolveDomain ¶
func (r *DomainRegistry) ResolveDomain(domain string) string
ResolveDomain resolves domain address, if not present returns an empty string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the DNS server wrapper object for dependency isolation, also implements dns.Handler for convenience
func NewServer ¶
func NewServer(logger *log.Logger, host string, port int, protocol string, registry *DomainRegistry) *Server
NewServer creates new server on specified host protocol and port and using provided DomainRegistry for domain resolution
func (*Server) ListenAndServe ¶
ListenAndServe blocks and listens to requests