You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 10, 2023. It is now read-only.
nfq-go is a Go library that wraps libnetfilter_queue.
4
+
5
+
## Usage
6
+
7
+
### Import
8
+
9
+
```go
10
+
import nfq "github.com/hownetworks/nfq-go"
11
+
```
12
+
13
+
### New
14
+
15
+
```go
16
+
queue, err:= nfq.New(0, func(pkt nfq.Packet) {
17
+
...
18
+
})
19
+
```
20
+
21
+
### Give a Verdict
22
+
23
+
`NF_ACCEPT`
24
+
25
+
```go
26
+
err:= pkt.Accept()
27
+
```
28
+
29
+
`NF_DROP`
30
+
31
+
```go
32
+
err:= pkt.Drop()
33
+
```
34
+
35
+
`NF_REPEAT`
36
+
37
+
```go
38
+
err:= pkt.Repeat()
39
+
```
40
+
41
+
`NF_QUEUE` to queue 5
42
+
43
+
```go
44
+
err:= pkt.Queue(x)
45
+
```
46
+
47
+
### Modifying Packets
48
+
49
+
Use `WithData(data []byte)` and `WithMark(mark uint32)` to modify the packet's data and mark. Instead of modifying the original these methods return a new `Packet` and can be chained.
50
+
51
+
As an example, here's how to (re)queue the packet to queue number 5, this time its data set to `newData` and mark set to `1234`:
0 commit comments