- Notifications
You must be signed in to change notification settings - Fork2
A nDPI wrapper by golang based on CGO
License
NotificationsYou must be signed in to change notification settings
fs714/go-ndpi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project is anDPI wrapper by golang based on CGO. You can use nDPI by golang to do packet inspection.
It is based on ndpi 4.4.0 release currently.
Clang lib nDPI should be installed firstly. Ubuntu 22.04 is used in follow guide.
- Install Package Repository for Ubuntu 22.04 LTS
apt-get install software-properties-common wgetadd-apt-repository universewget https://packages.ntop.org/apt-stable/22.04/all/apt-ntop-stable.debapt install ./apt-ntop-stable.deb
- Install nDPI
apt-get install ndpi-devldconfig -p | grep -i ndpifind /usr/lib/ | grep -i ndpifind /usr/include/ | grep -i ndpi
- Install required libs
- Libpcap is used for packet capture
- Maxminddb is enabled in 'libndpi' from apt-get. If you are using 'libndpi' which is installed by apt, 'libmaxminddb' is also required
apt-get install libpcap-dev libmaxminddb-devldconfig -p | grep -i maxmindfind /usr/lib/ | grep -i maxmindfind /usr/include/ | grep -i maxmind
There is a simple usage in in folderexample
which could be a good start.
You can see follow codes inndpi.go
- Linux lib path is
/usr/include/
, you can adapt it according to your ENV - Lib ndpi is static link while others are dynamic link
#cgo CFLAGS: -I/usr/include/#cgo LDFLAGS: -Wl,-Bstatic -lndpi -lmaxminddb -Wl,-Bdynamic -lpcap -lm -pthread