mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
log
This commit is contained in:
parent
72d0920458
commit
285cb346b9
@ -2,7 +2,6 @@ package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
@ -11,14 +10,12 @@ var ServerIP = ""
|
||||
func GetLocalIP() (string, error) {
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
|
||||
return "", err
|
||||
}
|
||||
for _, address := range addrs {
|
||||
|
||||
if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
|
||||
if ipnet.IP.To4() != nil {
|
||||
fmt.Println(ipnet.IP.String())
|
||||
return ipnet.IP.String(), nil
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user