nat

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeIGD

type FakeIGD struct {
	// contains filtered or unexported fields
}

FakeIGD presents itself as a discoverable UPnP device which sends canned responses to HTTPU and HTTP requests.

func NewIGDDev

func NewIGDDev() *FakeIGD

create a FakeIGD instance

func (*FakeIGD) Close

func (dev *FakeIGD) Close()

func (*FakeIGD) Listen

func (dev *FakeIGD) Listen() (err error)

func (*FakeIGD) Serve

func (dev *FakeIGD) Serve()

func (*FakeIGD) ServeHTTP

func (dev *FakeIGD) ServeHTTP(w http.ResponseWriter, r *http.Request)

http.Handler

func (*FakeIGD) ServeMessage

func (dev *FakeIGD) ServeMessage(r *http.Request)

httpu.Handler

type SOAPFaultError

type SOAPFaultError struct {
	FaultCode   string `xml:"faultcode"`
	FaultString string `xml:"faultstring"`
	Detail      string `xml:"detail"`
}

SOAPFaultError implements error, and contains SOAP fault information.

func (*SOAPFaultError) Error

func (err *SOAPFaultError) Error() string

type UpnpNat

type UpnpNat struct {
	// contains filtered or unexported fields
}

UpnpNat used to add nat port mapping through via upnp protocol

func DiscoverUPnPDevice

func DiscoverUPnPDevice() *UpnpNat

DiscoverUPnPDevice searches for Internet Gateway Devices and returns the first one it can find on the local network.

func (*UpnpNat) AddPortMapping

func (n *UpnpNat) AddPortMapping(protocol string, extport, intport int, desc string, lifetime time.Duration) error

AddPortMapping add port mapping

func (*UpnpNat) DeletePortMapping

func (n *UpnpNat) DeletePortMapping(protocol string, extport, intport int) error

DeletePortMapping delete port mapping

func (*UpnpNat) GetExternalIPAddress

func (n *UpnpNat) GetExternalIPAddress() (addr net.IP, err error)

GetExternalIPAddress get the external address.

Jump to

Keyboard shortcuts

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