This is a port of the GNOME Shell Extension called tun0 IP Address, available in the GNOME Shell Extension store at https://extensions.gnome.org/extension/5518/tun0-ip-address/ for Gnome 45 and upward that works with ECMAScript modules. I also added some improvements regarding looping and replaced obsolete api calls.
I often play CTF (Capture The Flag) on my ethical hacking journey and I need something that will show me my tun0 IP address.
This extension also respects your privacy and bandwidth, as it makes absolutely zero requests to the Internet and sends zero packets to the Internet. The plugin gets its information from the output of ifdata command (moreutils package dependency) and only displays the result in the GNOME panel; this information never leaves your computer.
moreutils package so ifdata command works.
Debian
sudo apt install moreutils
Red Hat
sudo yum install moreutils
Arch
sudo pacman -S moreutils
To get the tun0 IP address, internally this extension runs a shell command:
ifdata -pa tun0
The above command returns the IP address associated to your tun0 interface. You need first to be connected to a VPN service (using openVPN, for example). Within the (Javascript) extension code, I am simply matching the result to show it in Gnome panel.
What if you want to see your WAN or LAN IP address, too ? This is out of scope for this simple extension. This extension by design only shows your tun0 IP address, just as the name suggests. It is designed for everyone who only need to see their tun0 address in a convenient place, and with total privacy (no calls to the Internet). If you actually want your WAN IP address or IPv6 addresses, check out this extension instead: All IP Addresses Or if you actually want your LAN IP address, check out the extension this fork is based one instead: LAN IP address
As it is my first Gnome extension and javascript, there may be some code adjustments needed so feel free to ask/notify.