Documentation
¶
Index ¶
Constants ¶
const ( RootDevice = URN("upnp:rootdevice") All = URN("ssdp:all") )
Variables ¶
This section is empty.
Functions ¶
func BroadcastDevice ¶
BroadcastDevice broadcasts the presence of a UPnP Device, with its SSDP/SCPD served via HTTP at addr.
func DiscoverURLs ¶
DiscoverURLs discovers UPnP device manifest URLs using SSDP on the local network. It returns all valid URLs it finds, a slice of errors from invalid SSDP responses, and an error with the actual connection itself.
Types ¶
type Device ¶
type Device struct { // Name is the "friendly name" of a UPnP device. Name string // UDN is a unique identifier that can be used to rediscover a device. UDN string // DeviceType is yet another URN-alike. DeviceType DeviceType Icons []Icon Manufacturer string ManufacturerURL string ModelDescription string ModelName string ModelNumber string ModelURL string SerialNumber string PresentationURL string // contains filtered or unexported fields }
Device is an UPnP device.
func DiscoverDevices ¶
func DiscoverDevices(ctx context.Context, urn URN, iface *net.Interface) ([]*Device, []error, error)
DiscoverDevices discovers UPnP devices using SSDP on the local network. It returns all valid URLs it finds, a slice of errors from invalid SSDP responses or UPnP device manifests, and an error with the actual connection itself.
func (*Device) HTTPHandler ¶
ServeHTTP serves the SSDP/SCPD UPnP discovery interface, and marshals SOAP requests.
func (*Device) SOAPInterface ¶
SOAPClient returns a SOAP client for the given URN, and whether or not that client exists. A nil Device always returns (nil, false).
type DeviceCache ¶
type DeviceCache struct {
// contains filtered or unexported fields
}
DeviceCache is an automatically refreshing cache of UPnP devices, addressable by UDN.
func NewDeviceCache ¶
func NewDeviceCache(urn URN, options DeviceCacheOptions) *DeviceCache
NewDeviceCache returns a DeviceCache searching for the given URN, every refresh period, optionally on a specific network interface.
func (*DeviceCache) DeviceByUDN ¶
func (d *DeviceCache) DeviceByUDN(udn string) (*Device, bool)
DeviceByUDN returns the Device with a given UDN.
func (*DeviceCache) Devices ¶
func (d *DeviceCache) Devices() []*Device
Devices lists all currently known Devices.
func (*DeviceCache) Refresh ¶
func (d *DeviceCache) Refresh()
Refresh forces the DeviceCache to update itself by discovering UPnP devices.
type DeviceCacheOptions ¶
type DeviceType ¶
type DeviceType string