check

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NatPublicService string
	NatMasterAddr    string
	NatSlaveAddr     string
)
View Source
var (
	Version uint = 1
)

Functions

func AssertPrivatIP

func AssertPrivatIP(ip net.IP) bool

func CheckNatTypeWithPublic

func CheckNatTypeWithPublic(port int) (nattype enode.NATType)

func CheckNatTypeWithYou

func CheckNatTypeWithYou(port int) enode.NATType

func GenerateKey

func GenerateKey() (*ecdsa.PrivateKey, error)

func IPv4ToInt

func IPv4ToInt(ip net.IP) int

func IntToIPv4

func IntToIPv4(num int) net.IP

Types

type NATClient

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

func NewNATClient

func NewNATClient(priv *ecdsa.PrivateKey, master, slave *net.UDPAddr) *NATClient

func NewNATClientAssignPort

func NewNATClientAssignPort(priv *ecdsa.PrivateKey, master, slave *net.UDPAddr, listenPort int) *NATClient

func (*NATClient) Discover

func (c *NATClient) Discover() *enode.NATType

type NATConn

type NATConn struct {
	*net.UDPConn
	// contains filtered or unexported fields
}

func (*NATConn) DialTo

func (conn *NATConn) DialTo(to *net.UDPAddr, packet []byte) error

func (*NATConn) IP

func (conn *NATConn) IP() net.IP

func (*NATConn) Port

func (conn *NATConn) Port() int

type NATService

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

func NewNATService

func NewNATService(privateKey *ecdsa.PrivateKey, masterAddr, slaveAddr *net.UDPAddr) *NATService

func (*NATService) Close

func (nat *NATService) Close()

func (*NATService) Start

func (nat *NATService) Start()

type StatusStep

type StatusStep uint8
var (
	// Step 1, Check whether the client is capable of UDP communication and is behind a NAT
	Step1 StatusStep = 0x01
	// Step 2, Check whether the client NAT is Full Cone NAT
	Step2 StatusStep = 0x02
	// Step 3, Check whether the client NAT is symmetric NAT
	Step3 StatusStep = 0x03
	// Step 4, Check whether the client NAT is Restricted Cone NAT
	Step4 StatusStep = 0x04
	// Step 5, Check whether the client NAT Port Restricted Cone NAT
	Step5 StatusStep = 0x05
	// Step 6, finished
	Step6 StatusStep = 0x06
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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