From eb2f0f9c223cef7f7e03604b22d9e14fc9907970 Mon Sep 17 00:00:00 2001 From: starainrt Date: Wed, 18 Dec 2024 17:00:26 +0800 Subject: [PATCH] update go.mod --- go.mod | 2 +- libpcap/libpcap.go | 4 ++++ nfq/nfqueue.go | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index dd6a85e..554df46 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module b612.me/bcap -go 1.22.4 +go 1.20 require ( github.com/florianl/go-nfqueue/v2 v2.0.0 diff --git a/libpcap/libpcap.go b/libpcap/libpcap.go index 544f036..d2fe634 100644 --- a/libpcap/libpcap.go +++ b/libpcap/libpcap.go @@ -17,6 +17,10 @@ type NetCatch struct { stopFn context.CancelFunc } +func (n *NetCatch) Recall() func(gopacket.Packet) { + return n.fn +} + func (n *NetCatch) SetRecall(fn func(p gopacket.Packet)) { n.fn = fn } diff --git a/nfq/nfqueue.go b/nfq/nfqueue.go index c8468d5..981ba68 100644 --- a/nfq/nfqueue.go +++ b/nfq/nfqueue.go @@ -17,6 +17,10 @@ type NfQueue struct { recallFn func(id uint32, q *nfqueue.Nfqueue, p Packet) } +func (n *NfQueue) RecallFn() func(id uint32, q *nfqueue.Nfqueue, p Packet) { + return n.recallFn +} + type Packet struct { Packet gopacket.Packet Attr nfqueue.Attribute