mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
ea477ef2b4
commit
4d720bba7c
1 changed files with 6 additions and 5 deletions
|
@ -71,16 +71,17 @@ func (q *Queue) trackProtocols(pkt gopacket.Packet) {
|
||||||
// gather protocols stats
|
// gather protocols stats
|
||||||
pktLayers := pkt.Layers()
|
pktLayers := pkt.Layers()
|
||||||
for _, layer := range pktLayers {
|
for _, layer := range pktLayers {
|
||||||
proto := layer.LayerType().String()
|
proto := layer.LayerType()
|
||||||
if proto == "DecodeFailure" || proto == "Payload" || proto == "Ethernet" {
|
if proto == gopacket.LayerTypeDecodeFailure || proto == gopacket.LayerTypePayload {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
q.Lock()
|
q.Lock()
|
||||||
if _, found := q.Protos[proto]; found == false {
|
name := proto.String()
|
||||||
q.Protos[proto] = 1
|
if _, found := q.Protos[name]; found == false {
|
||||||
|
q.Protos[name] = 1
|
||||||
} else {
|
} else {
|
||||||
q.Protos[proto] += 1
|
q.Protos[name] += 1
|
||||||
}
|
}
|
||||||
q.Unlock()
|
q.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue