Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller manages SSDP advertisement and client interactions for a Switch
func NewController ¶
func NewController(name string, s Switch, opts ...ControllerOption) *Controller
NewController creates a smart switch controller with the specified options
func (*Controller) Start ¶
func (c *Controller) Start() (location string, err error)
Start will create and serve an HTTP service to manage a smart switch and advertise the service using SSDP
func (*Controller) Stop ¶
func (c *Controller) Stop() error
Stop will close the HTTP server and stop advertising over SSDP
type ControllerOption ¶
type ControllerOption func(*Controller)
ControllerOption values are accepted by NewController for custom configurations
func WithInterface ¶
func WithInterface(name string) ControllerOption
WithInterface allows the caller to specify a network interface to use for the Controller. The Controller will advertise services on the first IPv4 address of this interface
func WithListenAddress ¶
func WithListenAddress(addr net.IP) ControllerOption
WithListenAddress allows the caller to specify a single listen address for the controller to use (default is all IP addresses)
func WithListenPort ¶
func WithListenPort(p uint) ControllerOption
WithListenPort allows the caller to specify a strict TCP port to use for services provided by the Controller (default is system-assigned ephemeral port)
func WithMinissdpSocket ¶
func WithMinissdpSocket(path string) ControllerOption
WithMinissdpSocket is used to configure the controller to advertise via the Minissdpd service instead of starting an SSDP server (for Synology device support)
func WithURIPrefix ¶
func WithURIPrefix(s string) ControllerOption
WithURIPrefix allows the caller to configure a path prefix for the Wemo control URIs
func WithUUID ¶
func WithUUID(s string) ControllerOption
WithUUID allows the caller to specify a UUID value for the emulated switch (default: generated ID)