Documentation ¶
Index ¶
- func CheckNet() error
- func DelPortMapping(localPort, remotePort int)
- func ExternalIPAddr() (net.IP, error)
- type Creater
- type ExternalConnection
- func (ext *ExternalConnection) BuildNetworkEndpointEvent(method Method) api.Event
- func (ext *ExternalConnection) BuildP2PKey() string
- func (ext *ExternalConnection) GetPeerAddr() <-chan string
- func (ext *ExternalConnection) Listen(conn *net.UDPConn, messages chan *pkt)
- func (ext *ExternalConnection) ShouldTryPrivate() bool
- type Method
- func Create(ctx context.Context, method string, d *device.Device, logger *device.Logger, ...) (Method, error)
- func NewSTUN(ctx context.Context, d *device.Device, logger *device.Logger, ...) (Method, error)
- func NewUPnPIGD(ctx context.Context, d *device.Device, logger *device.Logger, ...) (Method, error)
- type STUN
- type UPnPIGD
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelPortMapping ¶
func DelPortMapping(localPort, remotePort int)
DelPortMapping delete port mapping in the gateway
Types ¶
type Creater ¶
type Creater func(context.Context, *device.Device, *device.Logger, profile.Profile, profile.PeerProfile) (Method, error)
Creater function
type ExternalConnection ¶
type ExternalConnection struct { PeerID string MyProfile profile.Profile PeerProfile profile.PeerProfile WgConn *net.UDPConn LocalPeerConn *net.UDPConn Device *device.Device Logger *device.Logger MyAddr *net.UDPAddr PeerAddr *net.UDPAddr Started bool Connected bool LastKeepalive time.Time TriedPrivate bool Ctx context.Context // contains filtered or unexported fields }
ExternalConnection struct
func (*ExternalConnection) BuildNetworkEndpointEvent ¶
func (ext *ExternalConnection) BuildNetworkEndpointEvent(method Method) api.Event
func (*ExternalConnection) BuildP2PKey ¶
func (ext *ExternalConnection) BuildP2PKey() string
func (*ExternalConnection) GetPeerAddr ¶
func (ext *ExternalConnection) GetPeerAddr() <-chan string
func (*ExternalConnection) Listen ¶
func (ext *ExternalConnection) Listen(conn *net.UDPConn, messages chan *pkt)
func (*ExternalConnection) ShouldTryPrivate ¶
func (ext *ExternalConnection) ShouldTryPrivate() bool
type Method ¶
Method interface
func Create ¶
func Create(ctx context.Context, method string, d *device.Device, logger *device.Logger, myProfile profile.Profile, peerProfile profile.PeerProfile) (Method, error)
Create function
type STUN ¶
type STUN struct {
ConnectionPeer *ExternalConnection
}
STUN struct
func (*STUN) GetPrivateAddr ¶
type UPnPIGD ¶
type UPnPIGD struct {
ConnectionPeer *ExternalConnection
}
UPnPIGD struct
func (*UPnPIGD) AddPortMapping ¶
AddPortMapping insert port mapping in the gateway
func (*UPnPIGD) GetExternalInfo ¶
GetExternalInfo fetch wan information
func (*UPnPIGD) GetPrivateAddr ¶
Click to show internal directories.
Click to hide internal directories.