Documentation
¶
Overview ¶
Package discovery provides ONVIF device discovery functionality using WS-Discovery protocol.
Package discovery provides error definitions for the discovery package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoProbeMatches is returned when no probe matches are found during discovery. ErrNoProbeMatches = errors.New("no probe matches found") // ErrNetworkInterfaceNotFound is returned when a network interface is not found. ErrNetworkInterfaceNotFound = errors.New("network interface not found") )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// Device endpoint address
EndpointRef string
// XAddrs contains the device service addresses
XAddrs []string
// Types contains the device types
Types []string
// Scopes contains the device scopes (name, location, etc.)
Scopes []string
// Metadata version
MetadataVersion int
}
Device represents a discovered ONVIF device.
func Discover ¶
Discover performs ONVIF device discovery using WS-Discovery protocol. For advanced options like specifying a network interface, use DiscoverWithOptions.
func DiscoverWithOptions ¶
func DiscoverWithOptions(ctx context.Context, timeout time.Duration, opts *DiscoverOptions) ([]*Device, error)
DiscoverWithOptions discovers ONVIF devices with custom options.
func (*Device) GetDeviceEndpoint ¶
GetDeviceEndpoint extracts the primary device endpoint from XAddrs.
func (*Device) GetLocation ¶
GetLocation extracts the device location from scopes.
type DiscoverOptions ¶
type DiscoverOptions struct {
// NetworkInterface specifies the network interface to use for multicast.
// If empty, the system will choose the default interface.
// Examples: "eth0", "wlan0", "192.168.1.100"
NetworkInterface string
}
DiscoverOptions contains options for device discovery.
type NetworkInterface ¶
type NetworkInterface struct {
// Name of the interface (e.g., "eth0", "wlan0")
Name string
// IP addresses assigned to this interface
Addresses []string
// Up indicates if the interface is up
Up bool
// Multicast indicates if the interface supports multicast
Multicast bool
}
NetworkInterface represents a network interface.
func ListNetworkInterfaces ¶
func ListNetworkInterfaces() ([]NetworkInterface, error)
ListNetworkInterfaces returns all available network interfaces with their addresses.
type ProbeMatch ¶
type ProbeMatch struct {
XMLName xml.Name `xml:"ProbeMatch"`
EndpointRef string `xml:"EndpointReference>Address"`
Types string `xml:"Types"`
Scopes string `xml:"Scopes"`
XAddrs string `xml:"XAddrs"`
MetadataVersion int `xml:"MetadataVersion"`
}
ProbeMatch represents a WS-Discovery probe match.
type ProbeMatches ¶
type ProbeMatches struct {
XMLName xml.Name `xml:"ProbeMatches"`
ProbeMatch []ProbeMatch `xml:"ProbeMatch"`
}
ProbeMatches represents WS-Discovery probe matches.