Documentation ¶
Overview ¶
Package upnp implements UPnP InternetGatewayDevice discovery, querying, and port mapping.
Index ¶
- func Discover(renewal, timeout time.Duration) []nat.Device
- type IGDService
- func (s *IGDService) AddPortMapping(protocol nat.Protocol, internalPort, externalPort int, description string, ...) (int, error)
- func (s *IGDService) DeletePortMapping(protocol nat.Protocol, externalPort int) error
- func (s *IGDService) GetExternalIPAddress() (net.IP, error)
- func (s *IGDService) GetLocalIPAddress() net.IP
- func (s *IGDService) ID() string
- type UnsupportedDeviceTypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IGDService ¶
type IGDService struct { UUID string Device upnpDevice ServiceID string URL string URN string LocalIP net.IP }
An IGDService is a specific service provided by an IGD.
func (*IGDService) AddPortMapping ¶
func (s *IGDService) AddPortMapping(protocol nat.Protocol, internalPort, externalPort int, description string, duration time.Duration) (int, error)
AddPortMapping adds a port mapping to the specified IGD service.
func (*IGDService) DeletePortMapping ¶
func (s *IGDService) DeletePortMapping(protocol nat.Protocol, externalPort int) error
DeletePortMapping deletes a port mapping from the specified IGD service.
func (*IGDService) GetExternalIPAddress ¶
func (s *IGDService) GetExternalIPAddress() (net.IP, error)
GetExternalIPAddress queries 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) GetLocalIPAddress ¶ added in v0.14.44
func (s *IGDService) GetLocalIPAddress() net.IP
GetLocalIPAddress returns local IP address used to contact this service
type UnsupportedDeviceTypeError ¶ added in v0.14.50
type UnsupportedDeviceTypeError struct {
// contains filtered or unexported fields
}
UnsupportedDeviceTypeError for unsupported UPnP device types (i.e upnp:rootdevice)
func (UnsupportedDeviceTypeError) Error ¶ added in v0.14.50
func (e UnsupportedDeviceTypeError) Error() string
Click to show internal directories.
Click to hide internal directories.