This commit is contained in:
黄思敏 2022-08-25 17:42:58 +08:00
parent 2a053ff127
commit a6adfa133e
4 changed files with 5 additions and 3 deletions

1
go.mod
View File

@ -7,6 +7,7 @@ require github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8
require github.com/klauspost/compress v1.15.9 // indirect
require (
github.com/474420502/random v0.5.1
github.com/golang/protobuf v1.5.2 // indirect
github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091 // indirect
golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c // indirect

2
go.sum
View File

@ -1,5 +1,7 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/474420502/random v0.5.1 h1:AA/r690QEKiVdCsFD9OKbjUmmtmLJQ7Qxd4IMVV1sbc=
github.com/474420502/random v0.5.1/go.mod h1:Kq5VC8ezVvzp9CUahvebIdlSiFdHzEzscaOScLvbw2c=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

3
rpc.go
View File

@ -1,7 +1,6 @@
package main
import (
"fmt"
"log"
"net"
gen "slimming/proto/gen"
@ -22,7 +21,7 @@ func newRPCServer(netCard *NetCard) *RPCServer {
func (rpc *RPCServer) run() {
lis, err := net.Listen("tcp", fmt.Sprintf("%s", config.Network.Self.Real))
lis, err := net.Listen("tcp", config.Network.Self.Real)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}

2
tap.go
View File

@ -162,7 +162,7 @@ func (nc *NetCard) runRead() {
var buffer *[][]byte
if buffer, ok = bytesMap[rframe.Destination().String()]; !ok {
mbuffer := make([][]byte, 100)
*buffer = mbuffer
buffer = &mbuffer
bytesMap[rframe.Destination().String()] = buffer
}