mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 20:38:51 +08:00
handle packet fowarding
This commit is contained in:
parent
669b417898
commit
1beee3ff02
1 changed files with 3 additions and 7 deletions
|
@ -160,13 +160,9 @@ func StartSniffer(ctx context.Context, ifaceName, ingGwAddr, extClientAddr strin
|
||||||
(ip.DstIP.String() == extClientAddr && ip.SrcIP.String() != ingGwAddr) {
|
(ip.DstIP.String() == extClientAddr && ip.SrcIP.String() != ingGwAddr) {
|
||||||
|
|
||||||
log.Println("-----> Fowarding PKT From: ", ip.SrcIP, " to: ", ip.DstIP)
|
log.Println("-----> Fowarding PKT From: ", ip.SrcIP, " to: ", ip.DstIP)
|
||||||
c, err := net.Dial("ip", ip.DstIP.String())
|
err := handle.WritePacketData(packet.Data())
|
||||||
if err == nil {
|
if err != nil {
|
||||||
c.Write(ip.Payload)
|
log.Println("----> failed to send packet data: ", err)
|
||||||
c.Close()
|
|
||||||
} else {
|
|
||||||
log.Println("------> Failed to forward packet from sniffer: ", err)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue