add ipv6 support

This commit is contained in:
kony
2025-01-24 13:56:58 +08:00
parent d18fd237ea
commit f7d6d4ec78
3 changed files with 25 additions and 25 deletions

View File

@@ -2,7 +2,6 @@ package utils
import (
"crypto/tls"
"fmt"
"io"
"net"
"net/http"
@@ -11,15 +10,6 @@ import (
"time"
)
func GetListenUDPPort(level string, port int) *net.UDPConn {
addr, _ := net.ResolveUDPAddr(level, fmt.Sprintf(":%d", port))
conn, err := net.ListenUDP(level, addr)
if err != nil {
Log().ErrorF("绑定端口失败: %v", err)
}
return conn
}
func GetUDPLocalIPPort(level string) (string, int) {
conn, err := net.Dial(level, "ifconfig.co:80")
if err != nil {