mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 21:51:23 +08:00
16 lines
373 B
Go
16 lines
373 B
Go
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) }}
|