mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-07 16:25:10 +08:00
增加 macvtap 模式支持
This commit is contained in:
17
server/pkg/utils/ip.go
Normal file
17
server/pkg/utils/ip.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
)
|
||||
|
||||
func Long2ip(i uint32) net.IP {
|
||||
ip := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(ip, i)
|
||||
return ip
|
||||
}
|
||||
|
||||
func Ip2long(ip net.IP) uint32 {
|
||||
ip = ip.To4()
|
||||
return binary.BigEndian.Uint32(ip)
|
||||
}
|
Reference in New Issue
Block a user