discovery

package
v0.0.0-...-f408f9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 7 Imported by: 0

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

View Source
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

func Discover(ctx context.Context, timeout time.Duration) ([]*Device, error)

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

func (d *Device) GetDeviceEndpoint() string

GetDeviceEndpoint extracts the primary device endpoint from XAddrs.

func (*Device) GetLocation

func (d *Device) GetLocation() string

GetLocation extracts the device location from scopes.

func (*Device) GetName

func (d *Device) GetName() string

GetName extracts the device name 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL