packagemain import( "fmt" "net" "strings" ) funcmain(){ conn,err:=net.Dial("udp","google.com:80") iferr!=nil{ fmt.Println(err.Error()) return } deferconn.Close() fmt.Println(strings.Split(conn.LocalAddr().String(),":")[0]) }
packagemain import( "fmt" "net" "strings" ) funcmain(){ conn,err:=net.Dial("udp","google.com:80") iferr!=nil{ fmt.Println(err.Error()) return } deferconn.Close() fmt.Println(strings.Split(conn.LocalAddr().String(),":")[0]) }