Feature: socks5 udp associate

This commit is contained in:
Dreamacro
2019-04-23 23:29:36 +08:00
parent 49f8902961
commit c92cda6980
25 changed files with 339 additions and 85 deletions

15
common/pool/pool.go Normal file
View File

@ -0,0 +1,15 @@
package pool
import (
"sync"
)
const (
// io.Copy default buffer size is 32 KiB
// but the maximum packet size of vmess/shadowsocks is about 16 KiB
// so define a buffer of 20 KiB to reduce the memory of each TCP relay
bufferSize = 20 * 1024
)
// BufPool provide buffer for relay
var BufPool = sync.Pool{New: func() interface{} { return make([]byte, bufferSize) }}