Documentation ¶
Index ¶
- Constants
- Variables
- func BasicDiscovery(service string, onentry func(*ServiceEntry) bool) error
- func Discovery(service string, onentry func(*ServiceEntry) bool) error
- func GetPTR(msg *dns.Msg) string
- func InterfacesIP4() ([]net.IP, error)
- func QueryOrDiscovery(host, service string, onentry func(*ServiceEntry) bool) error
- func SetsockoptIPMreq(fd uintptr, level, opt int, mreq *syscall.IPMreq) (err error)
- func SetsockoptInt(fd uintptr, level, opt int, value int) (err error)
- type Browser
- type ServiceEntry
Constants ¶
View Source
const ServiceHAP = "_hap._tcp.local." // HomeKit Accessory Protocol
Variables ¶
View Source
var MulticastAddr = &net.UDPAddr{ IP: net.IP{224, 0, 0, 251}, Port: 5353, }
Functions ¶
func BasicDiscovery ¶ added in v1.6.2
func BasicDiscovery(service string, onentry func(*ServiceEntry) bool) error
BasicDiscovery - default golang Multicast UDP listener. Does not work well with multiple interfaces.
func Discovery ¶
func Discovery(service string, onentry func(*ServiceEntry) bool) error
Discovery - better discovery version. Works well with multiple interfaces.
func InterfacesIP4 ¶ added in v1.6.2
func QueryOrDiscovery ¶ added in v1.6.2
func QueryOrDiscovery(host, service string, onentry func(*ServiceEntry) bool) error
QueryOrDiscovery - useful if we know previous device host and want to update port or any other information. Will work even over VPN.
func SetsockoptIPMreq ¶ added in v1.6.2
Types ¶
type Browser ¶ added in v1.6.2
type Browser struct { Service string Addr net.Addr Recv net.PacketConn Sends []net.PacketConn RecvTimeout time.Duration SendTimeout time.Duration }
func (*Browser) Browse ¶ added in v1.6.2
func (b *Browser) Browse(onentry func(*ServiceEntry) bool) error
func (*Browser) ListenMulticastUDP ¶ added in v1.6.2
ListenMulticastUDP - creates multiple senders socket (each for IP4 interface). And one receiver with multicast membership for each sender. Receiver will get multicast responses on senders requests.
type ServiceEntry ¶
func NewServiceEntry ¶
func NewServiceEntry(msg *dns.Msg) *ServiceEntry
func Query ¶ added in v1.6.2
func Query(host, service string) (entry *ServiceEntry, err error)
Query - direct Discovery request on device IP-address. Works even over VPN.
func (*ServiceEntry) Addr ¶
func (e *ServiceEntry) Addr() string
func (*ServiceEntry) Complete ¶
func (e *ServiceEntry) Complete() bool
Click to show internal directories.
Click to hide internal directories.