This repo contains code to build a tool to examine IP address a host is connecting to.
Here eBPF is used to write a program in kernel space using XDP to examine the packets and extract the IP address.
Since XDP is the earliest point where the packets can be intercepted it was very interesting to experiment with and learn.
All sorts of interesting things such as filtering and re-shaping plus introspection into the packet data can be performed using XDP.
Used Golang to write the userspace program to display the IP address with the count of packets.
Used Cilium eBPF to write the userspace Go code. There is a very handy tool bpf2go which can be used to generate the Go code from the eBPF code.