From 84537e98c4af423e092899224e36e2b1fbaf04f9 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 11 Sep 2022 00:20:06 -0400 Subject: [PATCH] Update xtls and go to 1.19 --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- go.mod | 8 ++++---- go.sum | 12 ++++++------ proxy/trojan/client.go | 2 +- proxy/trojan/protocol.go | 6 +++--- proxy/trojan/server.go | 2 +- proxy/vless/encoding/encoding.go | 6 +++--- proxy/vless/inbound/inbound.go | 2 +- proxy/vless/outbound/outbound.go | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29b76804..21bc7ea2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,7 +125,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.19 check-latest: true - name: Get project dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4043612e..6a04c3fc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.19 check-latest: true - name: Checkout codebase uses: actions/checkout@v3 diff --git a/go.mod b/go.mod index 2142a5b5..d0f9216f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/xtls/xray-core -go 1.18 +go 1.19 require ( github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 @@ -21,12 +21,12 @@ require ( github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb github.com/stretchr/testify v1.8.0 github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e - github.com/xtls/go v0.0.0-20210920065950-d4af136d3672 + github.com/xtls/go v0.0.0-20220914232946-0441cf4cf837 go.starlark.net v0.0.0-20220817180228-f738f5508c12 - golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d + golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde - golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 + golang.org/x/sys v0.0.0-20220913175220-63ea55921009 google.golang.org/grpc v1.49.0 google.golang.org/protobuf v1.28.1 h12.io/socks v1.0.3 diff --git a/go.sum b/go.sum index d0637fab..b1e12e9d 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,8 @@ github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= -github.com/xtls/go v0.0.0-20210920065950-d4af136d3672 h1:4mkzGhKqt3JO1BWYjtD3iRFyAx4ow67hmSqOcGjuxqQ= -github.com/xtls/go v0.0.0-20210920065950-d4af136d3672/go.mod h1:YGGVbz9cOxyKFUmhW7LGaLZaMA0cPlHJinvAmVxEMSU= +github.com/xtls/go v0.0.0-20220914232946-0441cf4cf837 h1:AHhUwwFJGl27E46OpdJHplZkK09m7aETNBNzhT6t15M= +github.com/xtls/go v0.0.0-20220914232946-0441cf4cf837/go.mod h1:YJTRELIWrGxR1s8xcEBgxcxBfwQfMGjdvNLTjN9XFgY= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= @@ -214,8 +214,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d h1:3qF+Z8Hkrw9sOhrFHti9TlB1Hkac1x+DNRkv0XQiFjo= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 h1:tnebWN09GYg9OLPss1KXj8txwZc6X6uMr6VFdcGNbHw= golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= @@ -282,8 +282,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw= +golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/proxy/trojan/client.go b/proxy/trojan/client.go index 9f0bc7fb..353b326e 100644 --- a/proxy/trojan/client.go +++ b/proxy/trojan/client.go @@ -126,7 +126,7 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter } if connWriter.Flow == XRD { xtlsConn.DirectMode = true - if sc, ok := xtlsConn.Connection.(syscall.Conn); ok { + if sc, ok := xtlsConn.NetConn().(syscall.Conn); ok { rawConn, _ = sc.SyscallConn() } } diff --git a/proxy/trojan/protocol.go b/proxy/trojan/protocol.go index b49314e6..38f0b854 100644 --- a/proxy/trojan/protocol.go +++ b/proxy/trojan/protocol.go @@ -303,14 +303,14 @@ func ReadV(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater, c iConn = statConn.Connection } if xc, ok := iConn.(*xtls.Conn); ok { - iConn = xc.Connection + iConn = xc.NetConn() } if tc, ok := iConn.(*net.TCPConn); ok { if conn.SHOW { fmt.Println(conn.MARK, "Splice") } runtime.Gosched() // necessary - w, err := tc.ReadFrom(conn.Connection) + w, err := tc.ReadFrom(conn.NetConn()) if counter != nil { counter.Add(w) } @@ -325,7 +325,7 @@ func ReadV(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater, c // panic("XTLS Splice: nil inbound or nil inbound.Conn") } } - reader = buf.NewReadVReader(conn.Connection, rawConn, nil) + reader = buf.NewReadVReader(conn.NetConn(), rawConn, nil) ct = counter if conn.SHOW { fmt.Println(conn.MARK, "ReadV") diff --git a/proxy/trojan/server.go b/proxy/trojan/server.go index 27afcfc9..618fbe10 100644 --- a/proxy/trojan/server.go +++ b/proxy/trojan/server.go @@ -255,7 +255,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Con xtlsConn.MARK = "XTLS" if clientReader.Flow == XRD { xtlsConn.DirectMode = true - if sc, ok := xtlsConn.Connection.(syscall.Conn); ok { + if sc, ok := xtlsConn.NetConn().(syscall.Conn); ok { rawConn, _ = sc.SyscallConn() } } diff --git a/proxy/vless/encoding/encoding.go b/proxy/vless/encoding/encoding.go index 436846f0..403e09cf 100644 --- a/proxy/vless/encoding/encoding.go +++ b/proxy/vless/encoding/encoding.go @@ -190,14 +190,14 @@ func ReadV(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater, c iConn = statConn.Connection } if xc, ok := iConn.(*xtls.Conn); ok { - iConn = xc.Connection + iConn = xc.NetConn() } if tc, ok := iConn.(*net.TCPConn); ok { if conn.SHOW { fmt.Println(conn.MARK, "Splice") } runtime.Gosched() // necessary - w, err := tc.ReadFrom(conn.Connection) + w, err := tc.ReadFrom(conn.NetConn()) if counter != nil { counter.Add(w) } @@ -212,7 +212,7 @@ func ReadV(reader buf.Reader, writer buf.Writer, timer signal.ActivityUpdater, c // panic("XTLS Splice: nil inbound or nil inbound.Conn") } } - reader = buf.NewReadVReader(conn.Connection, rawConn, nil) + reader = buf.NewReadVReader(conn.NetConn(), rawConn, nil) ct = counter if conn.SHOW { fmt.Println(conn.MARK, "ReadV") diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index 62c215e9..1a436f08 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -456,7 +456,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s xtlsConn.MARK = "XTLS" if requestAddons.Flow == vless.XRD { xtlsConn.DirectMode = true - if sc, ok := xtlsConn.Connection.(syscall.Conn); ok { + if sc, ok := xtlsConn.NetConn().(syscall.Conn); ok { rawConn, _ = sc.SyscallConn() } } diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index e114c3c4..de40aaeb 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -156,7 +156,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte } if requestAddons.Flow == vless.XRD { xtlsConn.DirectMode = true - if sc, ok := xtlsConn.Connection.(syscall.Conn); ok { + if sc, ok := xtlsConn.NetConn().(syscall.Conn); ok { rawConn, _ = sc.SyscallConn() } }