1 Star 0 Fork 1

SillyMan / Go实用工具包

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ip6util.go 477 Bytes
一键复制 编辑 原始数据 按行查看 历史
SillyMan 提交于 2022-01-06 09:32 . 添加 pinger
package ip6util
import (
"net"
)
// IsIPv6 判断是 IPv6 吗
func IsIPv6(ip net.IP) bool {
ip4 := ip.To4()
if ip4 == nil {
return true
}
return false
}
// GetNext 返回下一个 IP 地址
func GetNext(ip net.IP) net.IP {
if ip == nil {
return nil
}
ipLen := len(ip)
newIP := make(net.IP, ipLen)
copy(newIP, ip)
for i := ipLen - 1; i > 0; i-- {
if newIP[i] == 0xff {
newIP[i] = 0
continue
}
newIP[i]++
return newIP
}
return net.IPv6zero
}
Go
1
https://gitee.com/sillyman/simpleUtil.git
git@gitee.com:sillyman/simpleUtil.git
sillyman
simpleUtil
Go实用工具包
5c98b36afa10

搜索帮助