diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29da955..fbc8ca8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: id: current-time - name: Build - uses: tobyxdd/go-cross-build@e269fe09a60b9a6a7325cb06075e32ab1b7c2d12 + uses: thatisuday/go-cross-build@v1.1.0 env: TIME: "${{ steps.current-time.outputs.time }}" with: diff --git a/cmd/proxy_client.go b/cmd/proxy_client.go index 7e552e0..ca8d37d 100644 --- a/cmd/proxy_client.go +++ b/cmd/proxy_client.go @@ -83,7 +83,7 @@ func proxyClient(args []string) { client, err := core.NewClient(config.ServerAddr, config.Username, config.Password, tlsConfig, quicConfig, uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps, - func(refBPS uint64) congestion.ExternalSendAlgorithm { + func(refBPS uint64) congestion.CongestionControl { return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS)) }, obfuscator) if err != nil { diff --git a/cmd/proxy_server.go b/cmd/proxy_server.go index af15ac0..dc46f69 100644 --- a/cmd/proxy_server.go +++ b/cmd/proxy_server.go @@ -80,7 +80,7 @@ func proxyServer(args []string) { server, err := core.NewServer(config.ListenAddr, tlsConfig, quicConfig, uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps, - func(refBPS uint64) congestion.ExternalSendAlgorithm { + func(refBPS uint64) congestion.CongestionControl { return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS)) }, obfuscator, diff --git a/cmd/relay_client.go b/cmd/relay_client.go index a1ff4d7..aa36f7e 100644 --- a/cmd/relay_client.go +++ b/cmd/relay_client.go @@ -74,7 +74,7 @@ func relayClient(args []string) { client, err := core.NewClient(config.ServerAddr, config.Name, "", tlsConfig, quicConfig, uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps, - func(refBPS uint64) congestion.ExternalSendAlgorithm { + func(refBPS uint64) congestion.CongestionControl { return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS)) }, obfuscator) if err != nil { diff --git a/cmd/relay_server.go b/cmd/relay_server.go index e9bd281..d82a321 100644 --- a/cmd/relay_server.go +++ b/cmd/relay_server.go @@ -60,7 +60,7 @@ func relayServer(args []string) { server, err := core.NewServer(config.ListenAddr, tlsConfig, quicConfig, uint64(config.UpMbps)*mbpsToBps, uint64(config.DownMbps)*mbpsToBps, - func(refBPS uint64) congestion.ExternalSendAlgorithm { + func(refBPS uint64) congestion.CongestionControl { return hyCongestion.NewBrutalSender(congestion.ByteCount(refBPS)) }, obfuscator, diff --git a/go.mod b/go.mod index ed894b1..006c896 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 github.com/golang/protobuf v1.4.2 github.com/hashicorp/golang-lru v0.5.4 - github.com/lucas-clemente/quic-go v0.16.1 + github.com/lucas-clemente/quic-go v0.19.3 github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/sirupsen/logrus v1.6.0 github.com/txthinking/runnergroup v0.0.0-20200327135940-540a793bb997 // indirect @@ -15,4 +15,4 @@ require ( github.com/txthinking/x v0.0.0-20200330144832-5ad2416896a9 // indirect ) -replace github.com/lucas-clemente/quic-go => github.com/tobyxdd/quic-go v0.3.0-tquic-3 +replace github.com/lucas-clemente/quic-go => github.com/tobyxdd/quic-go v0.19.4-0.20210127052624-0ecb862c82b5 diff --git a/go.sum b/go.sum index 151f4b0..c74ef3d 100644 --- a/go.sum +++ b/go.sum @@ -89,11 +89,11 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/marten-seemann/qpack v0.2.0/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= +github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= github.com/marten-seemann/qtls v0.10.0 h1:ECsuYUKalRL240rRD4Ri33ISb7kAQ3qGDlrrl55b2pc= github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs= -github.com/marten-seemann/qtls-go1-15 v0.1.0 h1:i/YPXVxz8q9umso/5y474CNcHmTpA+5DH+mFPjx6PZg= -github.com/marten-seemann/qtls-go1-15 v0.1.0/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= +github.com/marten-seemann/qtls-go1-15 v0.1.1 h1:LIH6K34bPVttyXnUWixk0bzH6/N07VxbSabxn5A5gZQ= +github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -154,8 +154,10 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/tobyxdd/quic-go v0.3.0-tquic-3 h1:DjvbOSRydm1P+CYqg/Kb+awXELRpk01IhNhKiJTFCaQ= -github.com/tobyxdd/quic-go v0.3.0-tquic-3/go.mod h1:yXttHsSNxQi8AWijC/vLP+OJczXqzHSOcJrM5ITUlCg= +github.com/tobyxdd/quic-go v0.19.4-0.20210127045720-129416bb4da3 h1:suL8JW8PIg+Z8++ZHS8LZklmtoH/hV8tIYLaYcPMgOs= +github.com/tobyxdd/quic-go v0.19.4-0.20210127045720-129416bb4da3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8= +github.com/tobyxdd/quic-go v0.19.4-0.20210127052624-0ecb862c82b5 h1:/1YnZagiTQto8+NZ0Nx4G/vBN0ijX1QYMR0D3n8Zubc= +github.com/tobyxdd/quic-go v0.19.4-0.20210127052624-0ecb862c82b5/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8= github.com/txthinking/runnergroup v0.0.0-20200327135940-540a793bb997 h1:vlDgnShahmE2XLslpr0hnzxfAmSj3JLX2CYi8Xct7G4= github.com/txthinking/runnergroup v0.0.0-20200327135940-540a793bb997/go.mod h1:CLUSJbazqETbaR+i0YAhXBICV9TrKH93pziccMhmhpM= github.com/txthinking/socks5 v0.0.0-20200327133705-caf148ab5e9d h1:V+Wyj2AqtLwLG7KnniV8QG+gEkENPsudZbivvLyX4kw= diff --git a/pkg/congestion/brutal.go b/pkg/congestion/brutal.go index e375089..d49c6ac 100644 --- a/pkg/congestion/brutal.go +++ b/pkg/congestion/brutal.go @@ -14,7 +14,7 @@ const ( ) type BrutalSender struct { - rttStats congestion.RTTStats + rttStats congestion.RTTStatsProvider bps congestion.ByteCount pacer *pacer @@ -34,7 +34,7 @@ func NewBrutalSender(bps congestion.ByteCount) *BrutalSender { return bs } -func (b *BrutalSender) SetRTTStats(rttStats congestion.RTTStats) { +func (b *BrutalSender) SetRTTStatsProvider(rttStats congestion.RTTStatsProvider) { b.rttStats = rttStats } diff --git a/pkg/core/client.go b/pkg/core/client.go index 672283c..b590adc 100644 --- a/pkg/core/client.go +++ b/pkg/core/client.go @@ -166,7 +166,7 @@ func (c *Client) handleControlStream(qs quic.Session, stream quic.Stream) (pb.Au } // Set the congestion accordingly if resp.Result == pb.AuthResult_AUTH_SUCCESS && c.congestionFactory != nil { - qs.SetCongestion(c.congestionFactory(resp.Speed.ReceiveBps)) + qs.SetCongestionControl(c.congestionFactory(resp.Speed.ReceiveBps)) } return resp.Result, resp.Message, nil } diff --git a/pkg/core/server.go b/pkg/core/server.go index ba9fd7b..2a28270 100644 --- a/pkg/core/server.go +++ b/pkg/core/server.go @@ -175,7 +175,7 @@ func (s *Server) handleControlStream(cs quic.Session, stream quic.Stream) (strin } // Set the congestion accordingly if authResult == AuthResultSuccess && s.congestionFactory != nil { - cs.SetCongestion(s.congestionFactory(serverSendBPS)) + cs.SetCongestionControl(s.congestionFactory(serverSendBPS)) } return req.Credential.Username, authResult == AuthResultSuccess, nil } diff --git a/pkg/core/types.go b/pkg/core/types.go index a722c10..841da1f 100644 --- a/pkg/core/types.go +++ b/pkg/core/types.go @@ -10,4 +10,4 @@ const controlStreamTimeout = 10 * time.Second var controlProtocolEndian = binary.BigEndian -type CongestionFactory func(refBPS uint64) congestion.ExternalSendAlgorithm +type CongestionFactory func(refBPS uint64) congestion.CongestionControl