How To Install golang-github-nebulouslabs-go-upnp-dev on Ubuntu 22.04
Introduction
In this tutorial we learn how to install golang-github-nebulouslabs-go-upnp-dev
on Ubuntu 22.04.
What is golang-github-nebulouslabs-go-upnp-dev
golang-github-nebulouslabs-go-upnp-dev is:
The upnp package upnp provides a simple and opinionated interface to UPnP-enabled routers, allowing users to forward ports and discover their external IP address.
Specific quirks:
- When attempting to discover UPnP-enabled routers on the network, only the first such router is returned. If you have multiple routers, this may cause some trouble. But why would you do that?
- Forwarded ports are always symmetric, e.g. the router’s port 9980 will be mapped to the client’s port 9980. This will be unacceptable for some purposes, but too bad. Symmetric mappings are the desired behavior 99% of the time, and they save a function argument.
- TCP and UDP protocols are forwarded together.
- Ports are forwarded permanently. Some other implementations lease a port mapping for a set duration, and then renew it periodically. This is nice, because it means mappings won’t stick around after they’ve served their purpose. Unfortunately, some routers only support permanent mappings, so this package has chosen to support the lowest common denominator. To un-forward a port, you must use the Clear function (or do it manually).
Once you’ve discovered your router, you can retrieve its address by calling its Location method. This address can be supplied to Load to connect to the router directly, which is much faster than calling Discover.
See the godoc (http://godoc.org/github.com/NebulousLabs/upnp) for full documentation.
There are three methods to install golang-github-nebulouslabs-go-upnp-dev
on Ubuntu 22.04. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install golang-github-nebulouslabs-go-upnp-dev Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install golang-github-nebulouslabs-go-upnp-dev
using apt-get
by running the following command:
sudo apt-get -y install golang-github-nebulouslabs-go-upnp-dev
Install golang-github-nebulouslabs-go-upnp-dev Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install golang-github-nebulouslabs-go-upnp-dev
using apt
by running the following command:
sudo apt -y install golang-github-nebulouslabs-go-upnp-dev
Install golang-github-nebulouslabs-go-upnp-dev Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install golang-github-nebulouslabs-go-upnp-dev
using aptitude
by running the following command:
sudo aptitude -y install golang-github-nebulouslabs-go-upnp-dev
How To Uninstall golang-github-nebulouslabs-go-upnp-dev on Ubuntu 22.04
To uninstall only the golang-github-nebulouslabs-go-upnp-dev
package we can use the following command:
sudo apt-get remove golang-github-nebulouslabs-go-upnp-dev
Uninstall golang-github-nebulouslabs-go-upnp-dev And Its Dependencies
To uninstall golang-github-nebulouslabs-go-upnp-dev
and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:
sudo apt-get -y autoremove golang-github-nebulouslabs-go-upnp-dev
Remove golang-github-nebulouslabs-go-upnp-dev Configurations and Data
To remove golang-github-nebulouslabs-go-upnp-dev
configuration and data from Ubuntu 22.04 we can use the following command:
sudo apt-get -y purge golang-github-nebulouslabs-go-upnp-dev
Remove golang-github-nebulouslabs-go-upnp-dev configuration, data, and all of its dependencies
We can use the following command to remove golang-github-nebulouslabs-go-upnp-dev
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge golang-github-nebulouslabs-go-upnp-dev
References
- golang-github-nebulouslabs-go-upnp-dev website
- golang-github-nebulouslabs-go-upnp-dev on packages.ubuntu.com
Summary
In this tutorial we learn how to install golang-github-nebulouslabs-go-upnp-dev
package on Ubuntu 22.04 using different package management tools: apt
, apt-get
and aptitude
.