github.com/kelleygo/clashcore@v1.0.2/common/pool/buffer_standard.go (about)

     1  //go:build !with_low_memory
     2  
     3  package pool
     4  
     5  const (
     6  	// io.Copy default buffer size is 32 KiB
     7  	// but the maximum packet size of vmess/shadowsocks is about 16 KiB
     8  	// so define a buffer of 20 KiB to reduce the memory of each TCP relay
     9  	RelayBufferSize = 20 * 1024
    10  
    11  	// RelayBufferSize uses 20KiB, but due to the allocator it will actually
    12  	// request 32Kib. Most UDPs are smaller than the MTU, and the TUN's MTU
    13  	// set to 9000, so the UDP Buffer size set to 16Kib
    14  	UDPBufferSize = 16 * 1024
    15  )