Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = (&Options{ Key: "it's a secrecy", Crypt: "", Mode: "fast", MTU: 1350, SndWnd: 32, RcvWnd: 32, DataShard: 0, ParityShard: 0, DSCP: 0, AckNodelay: false, NoDelay: 0, Interval: 30, Resend: 2, NoCongestion: 1, SockBuf: 4194304, }).Apply()
DefaultOptions default kcp options
Functions ¶
func WithOptions ¶
WithOptions to wrap the kcp options
Types ¶
type Options ¶
type Options struct { Key string `json:"key"` Crypt string `json:"crypt"` // aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none Mode string `json:"mode"` // fast3, fast2, fast, normal, manual MTU int `json:"mtu,string"` // set maximum transmission unit for UDP packets SndWnd int `json:"sndwnd,string"` // set send window size(num of packets) RcvWnd int `json:"rcvwnd,string"` // set receive window size(num of packets) DataShard int `json:"datashard,string"` // set reed-solomon erasure coding - datashard ParityShard int `json:"parityshard,string"` // set reed-solomon erasure coding - parityshard DSCP int `json:"dscp,string"` // set DSCP(6bit) AckNodelay bool `json:"acknodelay,string"` // flush ack immediately when a packet is received NoDelay int `json:"nodelay,string"` Interval int `json:"interval,string"` Resend int `json:"resend,string"` NoCongestion int `json:"nc,string"` SockBuf int `json:"sockbuf,string"` // per-socket buffer in bytes Block kcp.BlockCrypt `json:"-"` }
Options to define the kcp
func FromContext ¶
FromContext to unwrap the kcp options
Click to show internal directories.
Click to hide internal directories.