Switch connection state lookups to use the packet.Info struct

Also, rename the Direction attribute on packet.Info to Inbound
This commit is contained in:
Daniel
2020-05-18 17:08:32 +02:00
parent 0036d25672
commit 7649859ba6
10 changed files with 95 additions and 139 deletions

View File

@@ -58,7 +58,15 @@ func checkForConflictingService() error {
}
func takeover(resolverIP net.IP) (int, error) {
pid, _, err := state.Lookup(0, packet.UDP, resolverIP, 53, nil, 0, false)
pid, _, err := state.Lookup(&packet.Info{
Inbound: true,
Version: 0, // auto-detect
Protocol: packet.UDP,
Src: nil, // do not record direction
SrcPort: 0, // do not record direction
Dst: resolverIP,
DstPort: 53,
})
if err != nil {
// there may be nothing listening on :53
return 0, nil