Listening to http traffic on a particular interface

Hello.
I am looking for a way to listen on http traffic only on a particular network interface (or alternatively be able to filter packets based on the interface they arrive from).

Any ideas?

Thanks in advance.

You probably want a pcap package, of which there are a few. Here’s a blog post describing how to use one of them: http://www.devdungeon.com/content/packet-capture-injection-and-analysis-gopacket

1 Like

Thanks I’ll have a look.

You mean you want to serve requests on a particular interface? You need to specify your own listener, something like this:

https://play.golang.org/p/EOZkK1UUpe

In that example the listener is limited to a port and IPv4 clients. Look at the documentation for net.Listener:

https://golang.org/pkg/net/#Listen

3 Likes

Marcelos answer is probably the right one here, I suspect I misunderstood you. :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.