diff --git a/go.mod b/go.mod index e06a8fc71..47345e0bf 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/xtaci/kcp-go/v5 v5.6.14 github.com/xtaci/qpp v1.1.17 github.com/xtaci/smux v1.5.26 - github.com/xtaci/tcpraw v1.2.30 + github.com/xtaci/tcpraw v1.2.31 golang.org/x/crypto v0.26.0 ) diff --git a/go.sum b/go.sum index 73f025550..4a3f25752 100644 --- a/go.sum +++ b/go.sum @@ -90,6 +90,8 @@ github.com/xtaci/tcpraw v1.2.29 h1:iVk1b2XiXNvIrMgtB3CkHCB/CigYXnG0tvFmOLUwCI8= github.com/xtaci/tcpraw v1.2.29/go.mod h1:T1blYD2EDkLneb+HtxddnzX38SoC9BG537EhkXeaT2k= github.com/xtaci/tcpraw v1.2.30 h1:JZlQaxcnSK0z827SPvV8bqqrv9SJdnQnnwX8Q7POFoM= github.com/xtaci/tcpraw v1.2.30/go.mod h1:T1blYD2EDkLneb+HtxddnzX38SoC9BG537EhkXeaT2k= +github.com/xtaci/tcpraw v1.2.31 h1:i9mXzejnGJdGi0DpVKUn19Hq202/sHOJt0kObEwuE/U= +github.com/xtaci/tcpraw v1.2.31/go.mod h1:T1blYD2EDkLneb+HtxddnzX38SoC9BG537EhkXeaT2k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/vendor/github.com/xtaci/tcpraw/fingerprints.go b/vendor/github.com/xtaci/tcpraw/fingerprints.go new file mode 100644 index 000000000..76ed6d241 --- /dev/null +++ b/vendor/github.com/xtaci/tcpraw/fingerprints.go @@ -0,0 +1,50 @@ +package tcpraw + +import ( + "encoding/binary" + "time" + + "github.com/google/gopacket/layers" +) + +type FingerPrintType int + +const ( + TypeLinux FingerPrintType = iota +) + +type fingerPrint struct { + Type FingerPrintType + Window uint16 + Options []layers.TCPOption + TTL uint16 +} + +// options [nop,nop,TS val 1940162183 ecr 1366690553] +var fingerPrintLinux = fingerPrint{ + Type: TypeLinux, + Window: 65535, + Options: []layers.TCPOption{ + {1, 0, nil}, + {1, 0, nil}, + {8, 10, make([]byte, 10)}, // len = 10 + }, + TTL: 64, +} + +var defaultFingerPrint = fingerPrintLinux + +var seed uint32 + +func init() { + seed = uint32(time.Now().UnixNano()) +} + +func makeOption(optType FingerPrintType, options []layers.TCPOption) { + switch optType { + case TypeLinux: + nowMilli := time.Now().UnixNano() / 1e9 + binary.BigEndian.PutUint32(options[2].OptionData[:4], uint32(nowMilli)) + binary.BigEndian.PutUint32(options[2].OptionData[4:], uint32(seed+uint32(nowMilli))) + } +}