Documentation
¶
Index ¶
- Constants
- Variables
- func NewDiscovery(c <-chan message, e chan<- event) (*discovery, error)
- func NewListener(domain, iface string, c chan<- message) (*listener, error)
- func NewService(zone string) *service
- func NewServiceDatabase() *servicedb
- func NewTokenizer(src string) *tokenizer
- func Quote(src string) string
- func ReadServiceDatabase(v string) (*servicedb, error)
- func Unquote(src string) (string, error)
- type Config
- type EventType
- type Server
- func (this Server) Changed(v *service) bool
- func (this Server) Delete(v *service)
- func (this *Server) EnumerateInstances(ctx context.Context, services ...string) ([]Service, error)
- func (this *Server) EnumerateServices(ctx context.Context) ([]string, error)
- func (this Server) Exists(v *service) *service
- func (this Server) Get(name string) *service
- func (this Server) Instances() []*service
- func (this Server) Lookup(service string) ServiceDescription
- func (this *Server) LookupServiceDescription(v string) ServiceDescription
- func (this Server) Query(ctx context.Context, msg *dns.Msg, iface int) error
- func (this Server) Read(v string) error
- func (this *Server) Run(ctx context.Context) error
- func (this Server) Send(msg *dns.Msg, ifIndex int) error
- func (this Server) Set(v *service)
- func (this *Server) String() string
- type ServiceDescription
- type ServiceEvent
Constants ¶
View Source
const ( ServicesQuery = "_services._dns-sd._udp" DefaultTTL = 60 * 5 // In seconds (5 mins) )
View Source
const (
DefaultServiceDatabase = "https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml"
)
View Source
const (
EOF rune = -(iota + 1)
)
Variables ¶
View Source
var ( MULTICAST_ADDR_IPV4 = &net.UDPAddr{IP: net.ParseIP("224.0.0.251"), Port: 5353} MULTICAST_ADDR_IPV6 = &net.UDPAddr{IP: net.ParseIP("ff02::fb"), Port: 5353} )
View Source
var (
ErrParseError = errors.New("Parse Error")
)
Functions ¶
func NewDiscovery ¶
func NewDiscovery(c <-chan message, e chan<- event) (*discovery, error)
func NewListener ¶
func NewService ¶
func NewService(zone string) *service
func NewServiceDatabase ¶
func NewServiceDatabase() *servicedb
func NewTokenizer ¶
func NewTokenizer(src string) *tokenizer
func ReadServiceDatabase ¶
Types ¶
type EventType ¶
type EventType int
const ( EVENT_TYPE_ADDED EventType = (1 << iota) EVENT_TYPE_REMOVED EVENT_TYPE_EXPIRED EVENT_TYPE_CHANGED EVENT_TYPE_SERVICE EVENT_TYPE_NONE EventType = 0 EVENT_TYPE_MIN = EVENT_TYPE_ADDED EVENT_TYPE_MAX = EVENT_TYPE_SERVICE )
func (EventType) FlagString ¶
type Server ¶
type Server struct { C chan Event // Channel for emitting events // contains filtered or unexported fields }
func (Server) Changed ¶
func (this Server) Changed(v *service) bool
Check if service has changed, returns false if service does not yet exist
func (*Server) EnumerateInstances ¶
func (*Server) EnumerateServices ¶
func (Server) Exists ¶
func (this Server) Exists(v *service) *service
Check if service already exists
func (Server) Get ¶
func (this Server) Get(name string) *service
Get returns a service by name, or nil if service not found
func (Server) Instances ¶
func (this Server) Instances() []*service
Instances returns service instances
func (*Server) LookupServiceDescription ¶
func (this *Server) LookupServiceDescription(v string) ServiceDescription
Return a service description for the given service name
type ServiceDescription ¶
type ServiceEvent ¶
type ServiceEvent interface { Event Type() EventType Service() Service }
Click to show internal directories.
Click to hide internal directories.