Documentation ¶
Overview ¶
Package upnp implements UPnP InternetGatewayDevice discovery, querying, and port mapping.
Index ¶
- type IGD
- func (n *IGD) AddPortMapping(protocol Protocol, externalPort, internalPort int, description string, ...) error
- func (n *IGD) DeletePortMapping(protocol Protocol, externalPort int) error
- func (n *IGD) FriendlyIdentifier() string
- func (n *IGD) FriendlyName() string
- func (n *IGD) URL() *url.URL
- func (n *IGD) UUID() string
- type IGDService
- type Protocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IGD ¶
type IGD struct {
// contains filtered or unexported fields
}
A container for relevant properties of a UPnP InternetGatewayDevice.
func Discover ¶
func Discover() []IGD
Discover discovers UPnP InternetGatewayDevices. The order in which the devices appear in the result list is not deterministic.
func (*IGD) AddPortMapping ¶
func (n *IGD) AddPortMapping(protocol Protocol, externalPort, internalPort int, description string, timeout int) error
Add a port mapping to all relevant services on the specified InternetGatewayDevice. Port mapping will fail and return an error if action is fails for _any_ of the relevant services. For this reason, it is generally better to configure port mapping for each individual service instead.
func (*IGD) DeletePortMapping ¶
Delete a port mapping from all relevant services on the specified InternetGatewayDevice. Port mapping will fail and return an error if action is fails for _any_ of the relevant services. For this reason, it is generally better to configure port mapping for each individual service instead.
func (*IGD) FriendlyIdentifier ¶ added in v0.10.2
The InternetGatewayDevice's friendly identifier (friendly name + IP address).
func (*IGD) FriendlyName ¶ added in v0.10.2
The InternetGatewayDevice's friendly name.
type IGDService ¶ added in v0.10.2
type IGDService struct {
// contains filtered or unexported fields
}
A container for relevant properties of a UPnP service of an IGD.
func (*IGDService) AddPortMapping ¶ added in v0.10.2
func (s *IGDService) AddPortMapping(localIPAddress string, protocol Protocol, externalPort, internalPort int, description string, timeout int) error
Add a port mapping to the specified IGD service.
func (*IGDService) DeletePortMapping ¶ added in v0.10.2
func (s *IGDService) DeletePortMapping(protocol Protocol, externalPort int) error
Delete a port mapping from the specified IGD service.
func (*IGDService) GetExternalIPAddress ¶ added in v0.10.2
func (s *IGDService) GetExternalIPAddress() (net.IP, error)
Query the IGD service for its external IP address. Returns nil if the external IP address is invalid or undefined, along with any relevant errors
func (*IGDService) ID ¶ added in v0.10.3
func (s *IGDService) ID() string