1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-07 17:00:24 +08:00

fix recv err in win

This commit is contained in:
fumiama
2021-12-30 13:17:12 +08:00
parent a4036a76bb
commit 4a17d7cf13
4 changed files with 7 additions and 4 deletions

2
go.mod
View File

@@ -6,7 +6,7 @@ require (
github.com/fumiama/go-base16384 v1.2.1
github.com/fumiama/go-x25519 v1.0.0
github.com/fumiama/gofastTEA v0.0.6
github.com/fumiama/water v0.0.0-20211229155341-82646596a427
github.com/fumiama/water v0.0.0-20211230051437-3d685121087a
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/sirupsen/logrus v1.8.1
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

2
go.sum
View File

@@ -12,6 +12,8 @@ github.com/fumiama/gofastTEA v0.0.6 h1:Yni3MXDbJVa/c4CecgdZDgCJK+fLdvGph+OBqY2mt
github.com/fumiama/gofastTEA v0.0.6/go.mod h1:+sBZ05nCA2skZkursHNvyr8kULlEetrYTM2y5kA4rQc=
github.com/fumiama/water v0.0.0-20211229155341-82646596a427 h1:6T/Y1o2wrNzJKjhjOsCVkKJwIlU8jfUBfRYFYQ9r3Uc=
github.com/fumiama/water v0.0.0-20211229155341-82646596a427/go.mod h1:BBnNY9PwK+UUn4trAU+H0qsMEypm7+3Bj1bVFuJItlo=
github.com/fumiama/water v0.0.0-20211230051437-3d685121087a h1:jVm9uuodbGiBqJzPEHSpYjdFZQ+B9SwBrpXCffr90GY=
github.com/fumiama/water v0.0.0-20211230051437-3d685121087a/go.mod h1:BBnNY9PwK+UUn4trAU+H0qsMEypm7+3Bj1bVFuJItlo=
github.com/fumiama/wintun v0.0.0-20211229152851-8bc97c8034c0 h1:WfrSFlIlCAtg6Rt2IGna0HhJYSDE45YVHiYqO4wwsEw=
github.com/fumiama/wintun v0.0.0-20211229152851-8bc97c8034c0/go.mod h1:dPOG7Af/ArO62RgBz2JJTNFByBn/IXWLo/1kZKcLSe8=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=

View File

@@ -60,11 +60,12 @@ func (m *Me) listen() (conn *net.UDPConn, err error) {
logrus.Infoln("[link] recv query")
p.onQuery(&packet)
case head.ProtoData:
logrus.Infoln("[link] deliver to", p.peerip)
if p.pipe != nil {
p.pipe <- &packet
logrus.Infoln("[link] deliver to pipe of", p.peerip)
} else {
m.pipe <- &packet
logrus.Infoln("[link] deliver to pipe of me")
}
default:
break

View File

@@ -46,12 +46,12 @@ func (nc *NIC) Start(m *link.Me) {
go func() { // 接收到 NIC
for nc.hasstart {
packet := m.Read()
_, err := nc.ifce.Write(packet.Data)
n, err := nc.ifce.Write(packet.Data)
if err != nil {
logrus.Errorln("[lower] recv write to nic err:", err)
break
}
logrus.Infoln("[lower] recv write", len(packet.Data), "bytes packet to nic")
logrus.Infoln("[lower] recv write", n, "bytes packet to nic")
}
}()
buf := make([]byte, 4096)