Skip to content

Commit

Permalink
🪿 Upgrade to Go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
database64128 committed Oct 5, 2023
1 parent e7fd39e commit 6eda2f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/database64128/swgp-go

go 1.20
go 1.21.1

require (
go.uber.org/zap v1.26.0
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
Expand All @@ -11,3 +15,4 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
12 changes: 3 additions & 9 deletions service/client_mmsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ func (c *client) recvFromWgConnRecvmmsg(ctx context.Context, wgConn *conn.MmsgRC

recvmmsgCount++
packetsReceived += uint64(n)
if burstBatchSize < n {
burstBatchSize = n
}
burstBatchSize = max(burstBatchSize, n)

c.mu.Lock()

Expand Down Expand Up @@ -477,9 +475,7 @@ main:

sendmmsgCount++
packetsSent += uint64(count)
if burstBatchSize < count {
burstBatchSize = count
}
burstBatchSize = max(burstBatchSize, count)

bufvecn := bufvec[:count]

Expand Down Expand Up @@ -649,9 +645,7 @@ func (c *client) relayProxyToWgSendmmsg(downlink clientNatDownlinkMmsg) {

sendmmsgCount++
packetsSent += uint64(ns)
if burstBatchSize < ns {
burstBatchSize = ns
}
burstBatchSize = max(burstBatchSize, ns)
}

c.logger.Info("Finished relay proxyConn -> wgConn",
Expand Down
12 changes: 3 additions & 9 deletions service/server_mmsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ func (s *server) recvFromProxyConnRecvmmsg(ctx context.Context, proxyConn *conn.

recvmmsgCount++
packetsReceived += uint64(n)
if burstBatchSize < n {
burstBatchSize = n
}
burstBatchSize = max(burstBatchSize, n)

s.mu.Lock()

Expand Down Expand Up @@ -458,9 +456,7 @@ func (s *server) relayProxyToWgSendmmsg(uplink serverNatUplinkMmsg) {

sendmmsgCount++
packetsSent += uint64(count)
if burstBatchSize < count {
burstBatchSize = count
}
burstBatchSize = max(burstBatchSize, count)

bufvecn := bufvec[:count]

Expand Down Expand Up @@ -631,9 +627,7 @@ func (s *server) relayWgToProxySendmmsg(downlink serverNatDownlinkMmsg) {

sendmmsgCount++
packetsSent += uint64(ns)
if burstBatchSize < ns {
burstBatchSize = ns
}
burstBatchSize = max(burstBatchSize, ns)
}

s.logger.Info("Finished relay wgConn -> proxyConn",
Expand Down

0 comments on commit 6eda2f1

Please sign in to comment.