Dealer/pkg/internal/gap/net.go
LittleSheep 466b240e95
Some checks failed
release-nightly / build-docker (push) Has been cancelled
🎉 Initial Commit
2024-07-14 20:25:30 +08:00

16 lines
254 B
Go

package gap
import "net"
func GetOutboundIP() (net.IP, error) {
conn, err := net.Dial("udp", "1.1.1.1:80")
if err != nil {
return nil, err
} else {
defer conn.Close()
}
localAddr := conn.LocalAddr().(*net.UDPAddr)
return localAddr.IP, nil
}