nat

package
v0.0.0-...-8af0b91 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ping byte = 1
	Data byte = 2

	FecData byte = 1
	FecOver byte = 2
)
View Source
const CacheBuffSize = SendBuffSize * 1.5
View Source
const SendBuffSize = 2000 //after kcp_send , 3k+, after compress, 3k+ * 1.5+ ,,this size is limited by bufio.Scanner

Variables

This section is empty.

Functions

func GatherCandidates

func GatherCandidates(sock *net.UDPConn, outIpList string, udpAddr string) ([]candidate, error)

Types

type AttemptEngine

type AttemptEngine struct {
	Kcp  *KcpSetting
	D, P int
	// contains filtered or unexported fields
}

func Init

func Init(outIpList string, buster bool, id int, udpAddr string) (*AttemptEngine, error)

func (*AttemptEngine) Fail

func (e *AttemptEngine) Fail()

func (*AttemptEngine) GetAddrList

func (e *AttemptEngine) GetAddrList() string

func (*AttemptEngine) GetConn

func (e *AttemptEngine) GetConn(f func(), encode, decode func([]byte) []byte) (net.Conn, error)

func (*AttemptEngine) SetOtherAddrList

func (e *AttemptEngine) SetOtherAddrList(addrList string)

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Ping

func (c *Conn) Ping() (int, error)

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) Run

func (c *Conn) Run()

func (*Conn) SetCrypt

func (c *Conn) SetCrypt(encode, decode func([]byte) []byte)

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetFec

func (c *Conn) SetFec(DataShards, ParityShards int) (er error)

func (*Conn) SetKcp

func (c *Conn) SetKcp(setting *KcpSetting)

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type 0, check, 1 msg

type KcpSetting

type KcpSetting struct {
	Nodelay  int32
	Interval int32 //not for set
	Resend   int32
	Nc       int32

	Sndwnd int32
	Rcvwnd int32

	Mtu int32
}

func DefaultKcpSetting

func DefaultKcpSetting() *KcpSetting

Directories

Path Synopsis
Package stun implements a subset of the Session Traversal Utilities for NAT (STUN) protocol, described in RFC 5389.
Package stun implements a subset of the Session Traversal Utilities for NAT (STUN) protocol, described in RFC 5389.

Jump to

Keyboard shortcuts

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