upnp

package
v0.14.53-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MPL-2.0 Imports: 17 Imported by: 10

Documentation

Overview

Package upnp implements UPnP InternetGatewayDevice discovery, querying, and port mapping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover

func Discover(renewal, timeout time.Duration) []nat.Device

Discover discovers UPnP InternetGatewayDevices. The order in which the devices appear in the results list is not deterministic.

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

func (*IGDService) ID

func (s *IGDService) ID() string

ID returns a unique ID for the servic

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

Jump to

Keyboard shortcuts

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