Created
December 10, 2021 01:51
-
-
Save ryanjafari/f584f5f639bcecffd284e5beb4605dd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/kamhlos/upnp" | |
"fmt" | |
) | |
func main() { | |
upnp := new(upnp.Upnp) | |
err := upnp.ExternalIPAddr() | |
if err != nil { | |
fmt.Println(err.Error()) | |
} else { | |
fmt.Println("Local IP Address:", upnp.LocalHost) | |
fmt.Println("UPNP Device IP Address:", upnp.Gateway.Host) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment