From 4e19050315091840b53210a240a025a44f18a6e5 Mon Sep 17 00:00:00 2001 From: e1732a364fed <75717694+e1732a364fed@users.noreply.github.com> Date: Sat, 1 Jan 2000 00:00:00 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3action;=E5=B0=86ConnWrapper?= =?UTF-8?q?=E7=9A=84GetRawConn=E6=94=B9=E4=B8=BAUpstream?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_release_extra.yml | 16 +++++++++++----- netLayer/netlayer.go | 2 +- proxy/simplesocks/tcpconn.go | 2 +- proxy/trojan/tcpconn.go | 6 +++--- proxy/vless/tcpconn.go | 2 +- tls_lazy.go | 10 ++++++---- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build_release_extra.yml b/.github/workflows/build_release_extra.yml index 37928b7..a0c71b1 100644 --- a/.github/workflows/build_release_extra.yml +++ b/.github/workflows/build_release_extra.yml @@ -88,20 +88,26 @@ jobs: run: | echo "ASSET_NAME=vs_gui_${{ matrix.os }}_${{ matrix.goarch }}" | Out-File -FilePath $env:GITHUB_ENV -Append - - if: ${{ matrix.os == 'macos-latest' }} - name: macos gnu-tar extra step - run: | - echo "PATH=\"$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$PATH\"" >> $GITHUB_ENV - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.19 - - name: Build + - if: ${{ matrix.os != 'macos-latest' }} + name: Build run: | cd cmd/verysimple/ && make -f Makefile_r_gui PACKNAME=${{ env.ASSET_NAME }} BUILD_VERSION=${{ github.event.inputs.tagName }} + - if: ${{ matrix.os == 'macos-latest' }} + name: macos Build + run: | + cd cmd/verysimple + go build -tags "gui" -trimpath -ldflags "-X 'main.Version=${{ github.event.inputs.tagName }}' -s -w -buildid=" + gtar -cJf ${{ env.ASSET_NAME }}.tar.xz verysimple* -C ../../ examples/ + rm verysimple* + + - name: touch xz archive shell: bash run: | diff --git a/netLayer/netlayer.go b/netLayer/netlayer.go index 15d4c52..d012dc4 100644 --- a/netLayer/netlayer.go +++ b/netLayer/netlayer.go @@ -90,7 +90,7 @@ func IsStrUDP_network(s string) bool { // 返回它所包装前的 那一层 net.Conn, 不一定是 基本连接, // 所以仍然可以继续 被识别为 ConnWrapper 并继续解包. type ConnWrapper interface { - GetRawConn() net.Conn + Upstream() net.Conn } // part of net.Conn diff --git a/proxy/simplesocks/tcpconn.go b/proxy/simplesocks/tcpconn.go index 753ea73..b6c7f65 100644 --- a/proxy/simplesocks/tcpconn.go +++ b/proxy/simplesocks/tcpconn.go @@ -19,7 +19,7 @@ type TCPConn struct { isServerEnd bool } -func (c *TCPConn) GetRawConn() net.Conn { +func (c *TCPConn) Upstream() net.Conn { return c.Conn } diff --git a/proxy/trojan/tcpconn.go b/proxy/trojan/tcpconn.go index f17f6bc..d034ab2 100644 --- a/proxy/trojan/tcpconn.go +++ b/proxy/trojan/tcpconn.go @@ -8,8 +8,8 @@ import ( "github.com/e1732a364fed/v2ray_simple/utils" ) -//trojan比较简洁,这个 UserTCPConn 只是用于读取握手读取时读到的剩余的缓存。 -//实现 net.Conn, io.ReaderFrom, utils.User, utils.MultiWriter, netLayer.Splicer, netLayer.ConnWrapper +// trojan比较简洁,这个 UserTCPConn 只是用于读取握手读取时读到的剩余的缓存。 +// 实现 net.Conn, io.ReaderFrom, utils.User, utils.MultiWriter, netLayer.Splicer, netLayer.ConnWrapper type UserTCPConn struct { net.Conn User @@ -22,7 +22,7 @@ type UserTCPConn struct { isServerEnd bool } -func (c *UserTCPConn) GetRawConn() net.Conn { +func (c *UserTCPConn) Upstream() net.Conn { return c.Conn } diff --git a/proxy/vless/tcpconn.go b/proxy/vless/tcpconn.go index d0a3b1b..49be4b1 100644 --- a/proxy/vless/tcpconn.go +++ b/proxy/vless/tcpconn.go @@ -36,7 +36,7 @@ func (u *UserTCPConn) GetProtocolVersion() int { return int(u.version) } -func (c *UserTCPConn) GetRawConn() net.Conn { +func (c *UserTCPConn) Upstream() net.Conn { return c.Conn } diff --git a/tls_lazy.go b/tls_lazy.go index 06fd929..10760da 100644 --- a/tls_lazy.go +++ b/tls_lazy.go @@ -27,8 +27,8 @@ func init() { } -//有TLS, network为tcp或者unix, 无AdvLayer. -//grpc 这种多路复用的链接是绝对无法开启 lazy的, ws 理论上也只有服务端发向客户端的链接 内嵌tls时可以lazy,但暂不考虑 +// 有TLS, network为tcp或者unix, 无AdvLayer. +// grpc 这种多路复用的链接是绝对无法开启 lazy的, ws 理论上也只有服务端发向客户端的链接 内嵌tls时可以lazy,但暂不考虑 func CanLazyEncrypt(x proxy.BaseInterface) bool { return x.IsUseTLS() && CanNetwork_tlsLazy(x.Network()) && x.AdvancedLayer() == "" @@ -43,7 +43,9 @@ func CanNetwork_tlsLazy(n string) bool { } // tryTlsLazyRawRelay 尝试能否直接对拷,对拷 直接使用 原始 TCPConn,也就是裸奔转发. -// 如果在linux上,则和 xtls的splice 含义相同. 在其他系统时,与xtls-direct含义相同。 +// +// 如果在linux上,则和 xtls的splice 含义相同. 在其他系统时,与xtls-direct含义相同。 +// // 我们内部先 使用 SniffConn 进行过滤分析,然后再判断进化为splice / 退化为普通拷贝. // // useSecureMethod仅用于 tls_lazy_secure @@ -109,7 +111,7 @@ func tryTlsLazyRawRelay(connid uint32, useSecureMethod bool, proxy_client proxy. rawWRC = tlsConn.GetRaw(true) } else { wrcWrapper := wrc.(netLayer.ConnWrapper) - tlsConn := wrcWrapper.GetRawConn().(*tlsLayer.Conn) + tlsConn := wrcWrapper.Upstream().(*tlsLayer.Conn) rawWRC = tlsConn.GetRaw(true) }