Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
eb2f0f9c22 | |||
3acc278811 |
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module b612.me/bcap
|
module b612.me/bcap
|
||||||
|
|
||||||
go 1.22.4
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/florianl/go-nfqueue/v2 v2.0.0
|
github.com/florianl/go-nfqueue/v2 v2.0.0
|
||||||
|
@ -17,6 +17,10 @@ type NetCatch struct {
|
|||||||
stopFn context.CancelFunc
|
stopFn context.CancelFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *NetCatch) Recall() func(gopacket.Packet) {
|
||||||
|
return n.fn
|
||||||
|
}
|
||||||
|
|
||||||
func (n *NetCatch) SetRecall(fn func(p gopacket.Packet)) {
|
func (n *NetCatch) SetRecall(fn func(p gopacket.Packet)) {
|
||||||
n.fn = fn
|
n.fn = fn
|
||||||
}
|
}
|
||||||
@ -60,6 +64,7 @@ func NewCatchEth(eth string, sentence string) (*NetCatch, error) {
|
|||||||
nc := new(NetCatch)
|
nc := new(NetCatch)
|
||||||
nc.eth = eth
|
nc.eth = eth
|
||||||
nc.sentence = sentence
|
nc.sentence = sentence
|
||||||
|
nc.ctx, nc.stopFn = context.WithCancel(context.Background())
|
||||||
return nc, nil
|
return nc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ type NfQueue struct {
|
|||||||
recallFn func(id uint32, q *nfqueue.Nfqueue, p Packet)
|
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 {
|
type Packet struct {
|
||||||
Packet gopacket.Packet
|
Packet gopacket.Packet
|
||||||
Attr nfqueue.Attribute
|
Attr nfqueue.Attribute
|
||||||
|
Loading…
x
Reference in New Issue
Block a user