remove duplicated dump

This commit is contained in:
testscript 2023-02-22 20:05:27 +08:00
parent ec63f38ba2
commit 028a3533a1
2 changed files with 5 additions and 11 deletions

View File

@ -83,8 +83,12 @@ func (device *Device) SendPacket(peer *Peer, usage path.Usage, ttl uint8, packet
}
func (device *Device) RoutineSendPacket() {
var elem *QueueOutboundElement
for {
var elem *QueueOutboundElement
if elem != nil {
device.PutMessageBuffer(elem.buffer)
device.PutOutboundElement(elem)
}
elem = device.NewOutboundElement()
params := <-device.chan_send_packet
offset := params.offset

View File

@ -19,8 +19,6 @@ import (
"github.com/KusakabeSi/EtherGuard-VPN/mtypes"
"github.com/KusakabeSi/EtherGuard-VPN/path"
"github.com/KusakabeSi/EtherGuard-VPN/tap"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"golang.org/x/crypto/chacha20poly1305"
)
@ -281,14 +279,6 @@ func (device *Device) RoutineReadFromTUN() {
if peer == nil {
continue
}
if device.LogLevel.LogNormal {
packet_len := len(elem.packet) - path.EgHeaderLen
fmt.Printf("Normal: Send Len:%v S:%v D:%v TTL:%v To:%v IP:%v:\n", packet_len, device.ID.ToString(), dst_nodeID.ToString(), elem.TTL, peer.ID.ToString(), peer.GetEndpointDstStr())
if device.LogLevel.DumpNormal {
packet_dump := gopacket.NewPacket(elem.packet[path.EgHeaderLen:], layers.LayerTypeEthernet, gopacket.Default)
fmt.Println(packet_dump.Dump())
}
}
device.SendPacket(peer, elem.Type, elem.TTL, elem.packet, offset)
}
} else {