Displaying bandwidth usage with Go

Programming Snapshot – Go Bandwidth Display

© Lead Image © xyzproject, 123RF.com

© Lead Image © xyzproject, 123RF.com

Article from Issue 284/2024
Author(s):

A Go program running on a Raspberry Pi grabs metrics from a pfSense firewall and displays them on a miniature display to help Mike Schilli keep an eye on his Internet connection's bandwidth usage.

Measuring the active throughput of an Internet connection is not entirely trivial, because nobody wants the measuring probe to slow down the data traffic. However, the router at the Internet access point has to view and forward all of the packets anyway, so why not let it also count them and provide the results via an API?

At home, I use a pfSense firewall on a fanless mini PC as my main router, which also runs some apps with access to the packet throughput (Figure 1). One of these apps is ntopng, which shows you in a browser which LAN client is currently communicating with which server on the Internet – among other things. Ntopng also offers an API with token authentication, which returns counters for the bits transferred in both directions.

Figure 1: pfSense dashboard.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Chip Shot

    We all know that the Fyne framework for Go can be used to create GUIs for the desktop, but you can also write games with it. Mike Schilli takes on a classic from the soccer field.

  • Google Chart

    The Google Chart API lets you draw custom graphs, charts, maps, and barcodes through a simple web interface.

  • Marathon Runners

    Rather than using ho-hum bar graphs to display Internet bandwidth usage, Mike Schilli enlists cartoon characters to do the job. Along the way, you get a free introduction to 2D gaming sprite technology.

  • Spotlight

    Before sharing screenshots, you may want to highlight points of interest. Mike Schilli whips up a Go app with the Fyne framework that acts like a highlighter pen.

  • Practically Elastic

    To improve his skill at the pool table, Mike Schilli sets out to program a simulation in Go using the Fyne framework.

comments powered by Disqus