Documentation
¶
Index ¶
- Variables
- func A(srv Service, iface *net.Interface) []*dns.A
- func AAAA(srv Service, iface *net.Interface) []*dns.AAAA
- func DNSSDServicesPTR(srv Service) *dns.PTR
- func LookupType(ctx context.Context, service string, add AddServiceFunc, rmv RmvServiceFunc) (err error)
- func NSEC(rr dns.RR, srv Service, iface *net.Interface) *dns.NSEC
- func PTR(srv Service) *dns.PTR
- func SRV(srv Service) *dns.SRV
- func TXT(srv Service) *dns.TXT
- type AddServiceFunc
- type Cache
- type MDNSConn
- type Query
- type ReadFunc
- type Request
- type Responder
- type Response
- type RmvServiceFunc
- type Service
- func LookupInstance(ctx context.Context, instance string) (srv Service, err error)
- func NewService(name, typ, domain, host string, ips []net.IP, port int) Service
- func ProbeService(ctx context.Context, srv Service) (Service, error)
- func ReprobeService(ctx context.Context, srv Service) (Service, error)
- func (srv Service) Copy() *Service
- func (srv Service) Equal(other Service) bool
- func (srv Service) Hostname() string
- func (srv Service) ServiceInstanceName() string
- func (srv Service) ServiceName() string
- func (srv Service) ServicesMetaQueryName() string
- func (srv *Service) SetHostname(hostname string)
- type ServiceHandle
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IPv4LinkLocalMulticast = net.ParseIP("224.0.0.251") IPv6LinkLocalMulticast = net.ParseIP("ff02::fb") AddrIPv4LinkLocalMulticast = &net.UDPAddr{ IP: IPv4LinkLocalMulticast, Port: 5353, } AddrIPv6LinkLocalMulticast = &net.UDPAddr{ IP: IPv6LinkLocalMulticast, Port: 5353, } TtlDefault uint32 = 75 * 60 // Default ttl for mDNS resource records TtlHostname uint32 = 120 // TTL for mDNS resource records containing the host name )
View Source
var DefaultResponder, _ = NewResponder()
Functions ¶
func DNSSDServicesPTR ¶
func LookupType ¶
func LookupType(ctx context.Context, service string, add AddServiceFunc, rmv RmvServiceFunc) (err error)
Types ¶
type AddServiceFunc ¶
type AddServiceFunc func(Service)
type MDNSConn ¶
type MDNSConn interface {
// SendQuery sends a mDNS query.
SendQuery(q *Query) error
// SendResponse sends a mDNS response
SendResponse(resp *Response) error
// Read returns a channel which receives mDNS messages
Read(ctx context.Context) <-chan *Request
// Close closes the connection
Close()
}
MDNSConn represents a mDNS connection. It encapsulates an IPv4 and IPv6 UDP connection.
func NewMDNSConn ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request represents an incoming mDNS message
type Responder ¶
type Responder interface {
// Add adds a service to the responder.
// Use the returned service handle to update service properties.
Add(srv Service) (ServiceHandle, error)
// Remove removes the service associated with the service handle from the responder.
Remove(srv ServiceHandle)
// Respond makes the receiver announcing and managing services.
Respond(ctx context.Context) error
}
Responder represents a mDNS responder.
func NewResponder ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is a mDNS response
type RmvServiceFunc ¶
type RmvServiceFunc func(Service)
type Service ¶
type Service struct {
Name string // e.g. Accessory (no trailing dot)
Type string // e.g. _hap._tcp.
Domain string // e.g. local.
Host string // e.g. MacBook (no trailing dot)
Text map[string]string
Ttl time.Duration // Original time to live
Port int
IPs []net.IP
IfaceIPs map[string][]net.IP
// contains filtered or unexported fields
}
Service represents a DNS-SD service instance
func LookupInstance ¶
LookupInstance resolves a service by its service instance name.
func ProbeService ¶
ProbeService probes for the hostname and service instance name of srv. If err == nil, the returned service is verified to be unique on the local network.
func (Service) ServiceInstanceName ¶
func (Service) ServiceName ¶
func (Service) ServicesMetaQueryName ¶
func (*Service) SetHostname ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.