Documentation ¶
Overview ¶
Package server implements an UPnP server and is the primary package to be used when building an UPnP server
Index ¶
- type Config
- type SOAPHandleFunc
- type Server
- func (me *Server) BootID() uint32
- func (me *Server) ConfigID() uint32
- func (me *Server) Connect() (err error)
- func (me *Server) Disconnect()
- func (me *Server) Errors() <-chan error
- func (me *Server) HTTPHandleFunc(pattern string, handleFunc func(http.ResponseWriter, *http.Request))
- func (me *Server) Run(ctx context.Context, wg *sync.WaitGroup)
- func (me *Server) SOAPHandleFunc(svcID string, act string, handler SOAPHandleFunc)
- func (me *Server) ServerString() (s string)
- func (me *Server) StateVariable(svcID, svName string) (sv *types.StatVar, exists bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Interfaces contain the names of the network interfaces to be used Interfaces []string // Port is the prot where the server listens Port int // MaxAge int ProductName string ProductVersion string StatusFile string }
Config represents the configuration of the UPnP server
type SOAPHandleFunc ¶
SOAPHandleFunc represents a handler function for calls of SOAP actions
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the UPnP server
func New ¶
func New(cfg Config, rootDesc *desc.RootDevice, svcDescs desc.ServiceMap) (srv *Server, err error)
New creates a new instance of the UPnP server from a device description and service descriptions. Note: The keys of the service map must correspond to the service ids in the device description
func (*Server) Disconnect ¶
func (me *Server) Disconnect()
Disconnect stops the SSDP processes and the multicast eventing
func (*Server) HTTPHandleFunc ¶
func (me *Server) HTTPHandleFunc(pattern string, handleFunc func(http.ResponseWriter, *http.Request))
HTTPHandleFunc is a wrapper around http.ServeMux.HandleFunc. It allowes to register handler functions for given patterns
func (*Server) SOAPHandleFunc ¶
func (me *Server) SOAPHandleFunc(svcID string, act string, handler SOAPHandleFunc)
SOAPHandleFunc allows to register functions to handle UPnP SOAP requests. Such handlers are defined per service ID / action combination
func (*Server) ServerString ¶
ServerString assembles the server string in the format "<OS>/<OS version> UPnP/<UPnP version> <product name>/<product version>"