package goupnp

Import Path
	github.com/huin/goupnp (on go.dev)

Dependency Relation
	imports 14 packages, and imported by 3 packages

Involved Source Files device.go goupnp is an implementation of a client for various UPnP services. For most uses, it is recommended to use the code-generated packages under github.com/huin/goupnp/dcps. Example use is shown at http://godoc.org/github.com/huin/goupnp/example A commonly used client is internetgateway1.WANPPPConnection1: http://godoc.org/github.com/huin/goupnp/dcps/internetgateway1#WANPPPConnection1 Currently only a couple of schemas have code generated for them from the UPnP example XML specifications. Not all methods will work on these clients, because the generated stubs contain the full set of specified methods from the XML specifications, and the discovered services will likely support a subset of those methods. network.go service_client.go
Package-Level Type Names (total 9)
/* sort by: | */
ContextError is an error that wraps an error with some context information. Context string Err error ( ContextError) Error() string ContextError : error
Device is a UPnP device. It can have child devices. DeviceType string Devices []Device FriendlyName string Icons []Icon Manufacturer string ManufacturerURL URLField ModelDescription string ModelName string ModelNumber string ModelType string ModelURL URLField Extra observed elements: SerialNumber string Services []Service UDN string UPC string FindService finds all (if any) Services under the device and its descendents that have the given ServiceType. SetURLBase sets the URLBase for the Device and its underlying components. (*Device) String() string VisitDevices calls visitor for the device, and all its descendent devices. VisitServices calls visitor for all Services under the device and all its descendent devices. *Device : expvar.Var *Device : fmt.Stringer
Icon is a representative image that a device might include in its description. Depth int32 Height int32 Mimetype string URL URLField Width int32 SetURLBase sets the URLBase for the Icon.
MaybeRootDevice contains either a RootDevice or an error. Any error encountered probing a discovered device. The address from which the device was discovered (if known - otherwise nil). The location the device was discovered at. This can be used with DeviceByURL, assuming the device is still present. A location represents the discovery of a device, regardless of if there was an error probing it. Set iff Err == nil. Identifier of the device. Note that this in combination with Location uniquely identifies a result from DiscoverDevices. func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) func DiscoverDevicesCtx(ctx context.Context, searchTarget string) ([]MaybeRootDevice, error)
RootDevice is the device description as described by section 2.3 "Device description" in http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf Device Device SpecVersion SpecVersion URLBase url.URL URLBaseStr string XMLName xml.Name SetURLBase sets the URLBase for the RootDevice and its underlying components. func DeviceByURL(loc *url.URL) (*RootDevice, error) func DeviceByURLCtx(ctx context.Context, loc *url.URL) (*RootDevice, error) func NewServiceClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL, searchTarget string) ([]ServiceClient, error) func github.com/huin/goupnp/dcps/internetgateway1.NewLANHostConfigManagement1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.LANHostConfigManagement1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewLayer3Forwarding1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.Layer3Forwarding1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANCableLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANCableLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANCommonInterfaceConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANCommonInterfaceConfig1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANDSLLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANDSLLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANEthernetLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANEthernetLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANIPConnection1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANIPConnection1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANPOTSLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANPOTSLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway1.NewWANPPPConnection1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway1.WANPPPConnection1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewDeviceProtection1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.DeviceProtection1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewLANHostConfigManagement1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.LANHostConfigManagement1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewLayer3Forwarding1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.Layer3Forwarding1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANCableLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANCableLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANCommonInterfaceConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANCommonInterfaceConfig1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANDSLLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANDSLLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANEthernetLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANEthernetLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANIPConnection1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANIPConnection1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANIPConnection2ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANIPConnection2, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANIPv6FirewallControl1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANIPv6FirewallControl1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANPOTSLinkConfig1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANPOTSLinkConfig1, error) func github.com/huin/goupnp/dcps/internetgateway2.NewWANPPPConnection1ClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL) ([]*internetgateway2.WANPPPConnection1, error)
Service is a service provided by a UPnP Device. ControlURL URLField EventSubURL URLField SCPDURL URLField ServiceId string ServiceType string (*Service) NewSOAPClient() *soap.SOAPClient RequestSCDP is for compatibility only, prefer RequestSCPD. This was a misspelling of RequestSCDP. RequestSCPD is the legacy version of RequestSCPDCtx, but uses context.Background() as the context. RequestSCPDCtx requests the SCPD (soap actions and state variables description) for the service. SetURLBase sets the URLBase for the Service. (*Service) String() string *Service : expvar.Var *Service : fmt.Stringer func (*Device).FindService(serviceType string) []*Service
ServiceClient is a SOAP client, root device and the service for the SOAP client rolled into one value. The root device, location, and service are intended to be informational. Location can be used to later recreate a ServiceClient with NewServiceClientByURL if the service is still present; bypassing the discovery process. Location *url.URL RootDevice *RootDevice SOAPClient *soap.SOAPClient Service *Service GetServiceClient returns the ServiceClient itself. This is provided so that the service client attributes can be accessed via an interface method on a wrapping type. LocalAddr returns the address from which the device was discovered (if known - otherwise empty). func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []error, err error) func NewServiceClientsByURL(loc *url.URL, searchTarget string) ([]ServiceClient, error) func NewServiceClientsByURLCtx(ctx context.Context, loc *url.URL, searchTarget string) ([]ServiceClient, error) func NewServiceClientsCtx(ctx context.Context, searchTarget string) (clients []ServiceClient, errors []error, err error) func NewServiceClientsFromRootDevice(rootDevice *RootDevice, loc *url.URL, searchTarget string) ([]ServiceClient, error) func (*ServiceClient).GetServiceClient() *ServiceClient
SpecVersion is part of a RootDevice, describes the version of the specification that the data adheres to. Major int32 Minor int32
URLField is a URL that is part of a device description. Ok bool Str string URL url.URL (*URLField) SetURLBase(urlBase *url.URL)
Package-Level Functions (total 9)
DiscoverDevices is the legacy version of DiscoverDevicesCtx, but uses context.Background() as the context.
DiscoverDevicesCtx attempts to find targets of the given type. This is typically the entry-point for this package. searchTarget is typically a URN in the form "urn:schemas-upnp-org:device:..." or "urn:schemas-upnp-org:service:...". A single error is returned for errors while attempting to send the query. An error or RootDevice is returned for each discovered RootDevice.
NewServiceClients is the legacy version of NewServiceClientsCtx, but uses context.Background() as the context.
NewServiceClientsByURL is the legacy version of NewServiceClientsByURLCtx, but uses context.Background() as the context.
NewServiceClientsByURLCtx creates client(s) for the given service URN, for a root device at the given URL.
NewServiceClientsCtx discovers services, and returns clients for them. err will report any error with the discovery process (blocking any device/service discovery), errors reports errors on a per-root-device basis.
NewServiceClientsFromDevice creates client(s) for the given service URN, in a given root device. The loc parameter is simply assigned to the Location attribute of the returned ServiceClient(s).
Package-Level Variables (total 2)
CharsetReaderDefault specifies the charset reader used while decoding the output from a UPnP server. It can be modified in an init function to allow for non-utf8 encodings, but should not be changed after requesting clients.
HTTPClient specifies the http.Client object used when fetching the XML from the UPnP server. HTTPClient defaults the http.DefaultClient. This may be overridden by the importing application.
Package-Level Constants (only one)
const DeviceXMLNamespace = "urn:schemas-upnp-org:device-1-0"