package main
import (
"fmt"
stun "github.com/ppma/nat-type"
)
const (
STUN_SERVER = "stun.qq.com"
STUN_PORT = 3478
)
func main() {
localAddr := fmt.Sprintf("%s:%d", "192.168.8.109", 8569)
stunAddr := fmt.Sprintf("%s:%d", STUN_SERVER, STUN_PORT)
result, err := stun.Query(stunAddr, localAddr)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Nat type: ", result.GetNatType())
fmt.Println("Public IP: ", result.GetIpAddr())
}