Files
open-im-server/internal/common/network/ip.go
T

24 lines
405 B
Go
Raw Normal View History

2023-02-09 10:58:30 +08:00
package network
import utils "github.com/OpenIMSDK/open_utils"
2023-02-09 11:30:31 +08:00
func GetRpcRegisterIP(configIP string) (string, error) {
2023-02-09 10:58:30 +08:00
registerIP := configIP
if registerIP == "" {
ip, err := utils.GetLocalIP()
if err != nil {
return "", err
}
registerIP = ip
}
return registerIP, nil
}
2023-02-09 11:30:31 +08:00
func GetListenIP(configIP string) string {
if configIP == "" {
return "0.0.0.0"
} else {
return configIP
}
}