mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 15:18:31 +08:00
修复 ipv6 记录显示不全的问题
This commit is contained in:
@@ -3,7 +3,6 @@ package utils
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Long2ip(i uint32) net.IP {
|
||||
@@ -16,16 +15,3 @@ func Ip2long(ip net.IP) uint32 {
|
||||
ip = ip.To4()
|
||||
return binary.BigEndian.Uint32(ip)
|
||||
}
|
||||
|
||||
// GetAddrIp 获取ip端口地址的ip数据
|
||||
func GetAddrIp(s string) string {
|
||||
if strings.Contains(s, ":") {
|
||||
ss := s[:strings.LastIndex(s, ":")]
|
||||
if strings.HasPrefix(ss, "[") {
|
||||
return strings.Trim(ss, "[]")
|
||||
}
|
||||
return ss
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
Reference in New Issue
Block a user