MCPcopy
hub / github.com/evilsocket/opensnitch / findEntryForProtocol

Function findEntryForProtocol

daemon/netstat/find.go:37–51  ·  view source on GitHub ↗
(proto string, srcIP net.IP, srcPort uint, dstIP net.IP, dstPort uint)

Source from the content-addressed store, hash-verified

35}
36
37func findEntryForProtocol(proto string, srcIP net.IP, srcPort uint, dstIP net.IP, dstPort uint) *Entry {
38 entries, err := Parse(proto)
39 if err != nil {
40 log.Warning("Error while searching for %s netstat entry: %s", proto, err)
41 return nil
42 }
43
44 for _, entry := range entries {
45 if srcIP.Equal(entry.SrcIP) && srcPort == entry.SrcPort && dstIP.Equal(entry.DstIP) && dstPort == entry.DstPort {
46 return &entry
47 }
48 }
49
50 return nil
51}

Callers 1

FindEntryFunction · 0.85

Calls 1

ParseFunction · 0.70

Tested by

no test coverage detected