Skip to content

Commit a4b3a44

Browse files
committed
Add simple example script from existing documentation. Regenerate netfilterqueue.c with Cython 0.25.2.
1 parent 2758696 commit a4b3a44

File tree

2 files changed

+1613
-1109
lines changed

2 files changed

+1613
-1109
lines changed

examples/print_and_accept.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
from netfilterqueue import NetfilterQueue
3+
4+
def print_and_accept(pkt):
5+
print(pkt)
6+
pkt.accept()
7+
8+
nfqueue = NetfilterQueue()
9+
nfqueue.bind(1, print_and_accept)
10+
try:
11+
nfqueue.run()
12+
except KeyboardInterrupt:
13+
print('')
14+
15+
nfqueue.unbind()

0 commit comments

Comments
 (0)