Skip to content
Nikos Filippakis edited this page Jul 30, 2017 · 3 revisions

go-dpi comes with an example application in order to demonstrate some of its capabilities. You may install the example application to the GOBIN directory by running the following command inside the go-dpi base directory.

go install ./godpi_example

Afterwards, the example application will be available at $GOBIN/godpi_example.

The example app can read the packets either from a dump file, or from a given device. Please note that reading from a device may need superuser capabilities. Therefore, the example app can be run in the following two ways:

By providing a dump file:

$GOBIN/godpi_example -filename godpi_example/dumps/http.cap

or by providing a device:

sudo $GOBIN/godpi_example -device wlan0

If neither a filename nor a device is given, the app will try to read from the default path “godpi_example/dumps/http.cap”, which is contained in go-dpi.

Either way, the app will print, for each packet, the protocol detected by the library and the wrappers. When the app is interrupted by pressing Ctrl+C in the console (or when the entire dump file has been read), some statistics will be shown about the detected protocols.

The execution of the app without any input should yield the following result by reading the default dump file:

Packet #1: Could not identify (new flow)
Packet #2: Could not identify
Packet #3: Could not identify
Packet #4: Detected protocol HTTP from source go-dpi
Packet #5: Detected protocol HTTP from source go-dpi
Packet #6: Detected protocol HTTP from source go-dpi
Packet #7: Detected protocol HTTP from source go-dpi
Packet #8: Detected protocol HTTP from source go-dpi
Packet #9: Detected protocol HTTP from source go-dpi
Packet #10: Detected protocol HTTP from source go-dpi
Packet #11: Detected protocol HTTP from source go-dpi
Packet #12: Detected protocol HTTP from source go-dpi
Packet #13: Detected protocol DNS from source go-dpi (new flow)
Packet #14: Detected protocol HTTP from source go-dpi
Packet #15: Detected protocol HTTP from source go-dpi
Packet #16: Detected protocol HTTP from source go-dpi
Packet #17: Detected protocol DNS from source go-dpi
Packet #18: Detected protocol HTTP from source go-dpi (new flow)
Packet #19: Detected protocol HTTP from source go-dpi
Packet #20: Detected protocol HTTP from source go-dpi
Packet #21: Detected protocol HTTP from source go-dpi
Packet #22: Detected protocol HTTP from source go-dpi
Packet #23: Detected protocol HTTP from source go-dpi
Packet #24: Detected protocol HTTP from source go-dpi
Packet #25: Detected protocol HTTP from source go-dpi
Packet #26: Detected protocol HTTP from source go-dpi
Packet #27: Detected protocol HTTP from source go-dpi
Packet #28: Detected protocol HTTP from source go-dpi
Packet #29: Detected protocol HTTP from source go-dpi
Packet #30: Detected protocol HTTP from source go-dpi
Packet #31: Detected protocol HTTP from source go-dpi
Packet #32: Detected protocol HTTP from source go-dpi
Packet #33: Detected protocol HTTP from source go-dpi
Packet #34: Detected protocol HTTP from source go-dpi
Packet #35: Detected protocol HTTP from source go-dpi
Packet #36: Detected protocol HTTP from source go-dpi
Packet #37: Detected protocol HTTP from source go-dpi
Packet #38: Detected protocol HTTP from source go-dpi
Packet #39: Detected protocol HTTP from source go-dpi
Packet #40: Detected protocol HTTP from source go-dpi
Packet #41: Detected protocol HTTP from source go-dpi
Packet #42: Detected protocol HTTP from source go-dpi
Packet #43: Detected protocol HTTP from source go-dpi

Number of packets: 43
Number of packets identified: 40
Protocols identified:
 map[HTTP:38 DNS:2]

Running the example app is also possible by using the Docker image.

Clone this wiki locally