1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-29 23:30:37 +08:00

feat: split udp protocol to folder p2p

This commit is contained in:
源文雨
2024-07-14 22:26:44 +09:00
parent 4a8e848673
commit 32af3ce142
16 changed files with 180 additions and 49 deletions

View File

@@ -103,11 +103,11 @@ func (l *Link) write(p *head.Packet, teatype uint8, additional uint16, datasz ui
bound = len(d)
endl = "."
}
logrus.Debugln("[send] write", len(d), "bytes data from ep", l.me.udpconn.LocalAddr(), "to", peerep, "offset:", fmt.Sprintf("%04x", offset))
logrus.Debugln("[send] write", len(d), "bytes data from ep", l.me.conn.LocalAddr(), "to", peerep, "offset:", fmt.Sprintf("%04x", offset))
logrus.Debugln("[send] data bytes", hex.EncodeToString(d[:bound]), endl)
d = l.me.xorenc(d)
logrus.Debugln("[send] data xored", hex.EncodeToString(d[:bound]), endl)
n, err = l.me.udpconn.WriteToUDP(d, peerep)
n, err = l.me.conn.WriteToPeer(d, peerep)
cl()
return
}