nat

package
v0.0.0-...-320032a Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NatTypeError    = iota // 未知类型
	NatTypeTaper           // 完全锥型
	NatTypeIp              // IP限制型
	NatTypePort            // 端口限制型
	NatTypeSymmetry        // 对称型
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conn       *net.UDPConn // UDP连接
	ServerAddr net.UDPAddr  // UDP连接
	ExportAddr net.UDPAddr  // UDP连接
	NatType    int          // NAT 类型
}

func NewClient

func NewClient() *Client

func (*Client) CheckNatType

func (c *Client) CheckNatType() error

func (*Client) DialUDP

func (c *Client) DialUDP(serverIp string, serverPort int) error

func (*Client) HasNatProtection

func (c *Client) HasNatProtection() (bool, error)

第一步,判断是否有 NAT 防护主机向服务器

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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