
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
go get github.com/lukechampine/upnp
Yep, it's another package for forwarding ports and discovering your external IP address. This one has no dependencies and is ~1 MB smaller than huin/goupnp. It also offers a more flexible device scanning API: devices are returned via channel as soon as they respond (typically a few milliseconds) rather than all devices being returned after a timeout of 2 seconds (as in huin/goupnp).
// scan for router
d, _ := upnp.Discover(context.Background())
// connect to a previously-scanned router
routerURL := d.Location()
d, _ = upnp.Connect(context.Background(), routerURL)
// forward/clear a port
println(d.IsForwarded(15000, "TCP")) // false
d.Forward(15000, "TCP", "example description")
println(d.IsForwarded(15000, "TCP")) // true
d.Clear(15000, "TCP")
println(d.IsForwarded(15000, "TCP")) // false
// get external IP
ip, _ := d.ExternalIP()
println(ip)
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.