29 lines
682 B
Go
29 lines
682 B
Go
package ss
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/snail007/goproxy/utils"
|
|
)
|
|
|
|
const leakyBufSize = 4108 // data.len(2) + hmacsha1(10) + data(4096)
|
|
const maxNBuf = 2048
|
|
|
|
var leakyBuf = utils.NewLeakyBuf(maxNBuf, leakyBufSize)
|
|
|
|
const (
|
|
idType = 0 // address type index
|
|
idIP0 = 1 // ip addres start index
|
|
idDmLen = 1 // domain address length index
|
|
idDm0 = 2 // domain address start index
|
|
|
|
typeIPv4 = 1 // type is ipv4 address
|
|
typeDm = 3 // type is domain address
|
|
typeIPv6 = 4 // type is ipv6 address
|
|
|
|
lenIPv4 = net.IPv4len + 2 // ipv4 + 2port
|
|
lenIPv6 = net.IPv6len + 2 // ipv6 + 2port
|
|
lenDmBase = 2 // 1addrLen + 2port, plus addrLen
|
|
lenHmacSha1 = 10
|
|
)
|