mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-04 23:40:26 +08:00
feat: impl. trans & ttl
This commit is contained in:
@@ -12,7 +12,9 @@ import (
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/tcp" // support tcp connection
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/udp" // support udp connection
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/udplite" // support udplite connection
|
||||
_ "github.com/fumiama/WireGold/gold/proto" // support basic protos
|
||||
_ "github.com/fumiama/WireGold/gold/proto/data" // support data proto
|
||||
_ "github.com/fumiama/WireGold/gold/proto/hello" // support hello proto
|
||||
_ "github.com/fumiama/WireGold/gold/proto/nat" // support nat proto
|
||||
|
||||
"github.com/fumiama/WireGold/config"
|
||||
"github.com/fumiama/WireGold/gold/head"
|
||||
@@ -125,7 +127,7 @@ func (s *Tunnel) handleWrite() {
|
||||
binary.LittleEndian.PutUint32(buf[:4], seq)
|
||||
seq++
|
||||
copy(buf[4:], b[:s.mtu-4])
|
||||
s.l.WritePacket(head.ProtoData, buf)
|
||||
s.l.WritePacket(head.ProtoData, buf, s.l.Me().TTL())
|
||||
if config.ShowDebugLog {
|
||||
logrus.Debugln("[tunnel] seq", seq-1, "written")
|
||||
}
|
||||
@@ -134,7 +136,7 @@ func (s *Tunnel) handleWrite() {
|
||||
binary.LittleEndian.PutUint32(buf[:4], seq)
|
||||
seq++
|
||||
copy(buf[4:], b)
|
||||
s.l.WritePacket(head.ProtoData, buf[:len(b)+4])
|
||||
s.l.WritePacket(head.ProtoData, buf[:len(b)+4], s.l.Me().TTL())
|
||||
if config.ShowDebugLog {
|
||||
logrus.Debugln("[tunnel] seq", seq-1, "written")
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ import (
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/tcp" // support tcp connection
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/udp" // support udp connection
|
||||
_ "github.com/fumiama/WireGold/gold/p2p/udplite" // support udplite connection
|
||||
_ "github.com/fumiama/WireGold/gold/proto" // support basic protos
|
||||
_ "github.com/fumiama/WireGold/gold/proto/data" // support data proto
|
||||
_ "github.com/fumiama/WireGold/gold/proto/hello" // support hello proto
|
||||
_ "github.com/fumiama/WireGold/gold/proto/nat" // support nat proto
|
||||
|
||||
"github.com/fumiama/WireGold/config"
|
||||
"github.com/fumiama/WireGold/gold/link"
|
||||
@@ -115,6 +117,7 @@ func (wg *WG) init(srcport, dstport uint16) {
|
||||
SpeedLoop: wg.c.SpeedLoop,
|
||||
Mask: wg.c.Mask,
|
||||
Base14: wg.c.Base14,
|
||||
MaxTTL: wg.c.MaxTTL,
|
||||
})
|
||||
|
||||
for _, peer := range wg.c.Peers {
|
||||
|
||||
Reference in New Issue
Block a user