go-upnp

module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-3.0

README

REUSE status PkgGoDev

go-upnp is a library that supports building UPnP servers in Go

Installation

Run go get -u gitlab.com/mipimipi/go-upnp.

Usage

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
  • Eventing
  • 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

This example shows how a simple UPnP music server can be built with go-upnp. You find more detailed information about how to use go-upnp to build a server here.

Description files

The go-upnp server requires a device and service descriptions. These descriptions can come from XML files (see [2], [3] and [4] 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.

Configuration

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

Logging

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

Further Reading

[1] UPnP Standards and Architecture

[2] UPnP Device Architecture version 2.0 (PDF)

[3] UPnP ContentDirectory Service (PDF)

[4] UPnP ConnectionManager Service (PDF)

[5] UPnP MediaServer and MediaRenderer

Directories

Path Synopsis
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
gen
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.

Jump to

Keyboard shortcuts

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