go get -u gitlab.com/mipimipi/go-upnp.
You can focus on the specific application logic of your server and don't have to bother with all the generic UPnP stuff. go-upnp takes care of ...
- Device discovery, i.e. SSDP notifications and search responses
- Provisioning of device and service descriptions
- Management of state variables
- Receipt and verification of service control calls, sending of responses
The go-upnp server requires ...
- a device description
- service descriptions
- handler functions for HTTP and SOAP action calls
The go-upnp server requires a device and service descriptions. These descriptions can come from XML files (see ,  and  for further information; see the example server for an example device description and an example description for a ContentDirectory service). Go-upnp provides functions to create the input data for the server from such files.
Besides device and service descriptions, go-upnp requires a simple configuration to create a server. If no configuration is provided the default values are used:
- All network interfaces are used by the server
- The server listens on port 8008
go-upnp uses logrus for logging. It uses the logrus default configuration (i.e. output on stdout with text formatter and info level). If you don't want that, configure the output, formatter and level in your server application. This will also be adhered to by the logging of go-upnp server.
Scope and Limitations
go-upnp implements the UPnP Device Architecture version 2.0, except:
SSDP update notifications
go-upnp does not send update notifications if network interfaces or server IP addresses changed. Thus, it's recommended to give the server a static IP address and to restart the server if network interfaces were changed.
Chunked transfer encoding that was introduced with HTTP 1.1
Custom UPnP data types
go-upnp only supports the standard UPnP data types
Package desc implements data types to map to the content from description XML files
|Package desc implements data types to map to the content from description XML files|
Package events implements eventing for state variables.
|Package events implements eventing for state variables.|
Package network contains function of facilitate sending and receiving messages via UDP and TCP
|Package network contains function of facilitate sending and receiving messages via UDP and TCP|
Package server implements an UPnP server and is the primary package to be used when building an UPnP server
|Package server implements an UPnP server and is the primary package to be used when building an UPnP server|
Package soap implements data types for SOAP messages
|Package soap implements data types for SOAP messages|
Package ssdp implements an SSDP (=Simple Service Discovery Protocol) server
|Package ssdp implements an SSDP (=Simple Service Discovery Protocol) server|
Package types implements data types that are used internally
|Package types implements data types that are used internally|
Package main generates the Go types that implement the SOAP types i4, ui2, string, fixed.14.4 etc.
|Package main generates the Go types that implement the SOAP types i4, ui2, string, fixed.14.4 etc.|