增加 macvtap 模式支持

This commit is contained in:
bjdgyc
2021-08-12 18:17:20 +08:00
parent 5010d2ecbd
commit 903554533b
19 changed files with 295 additions and 125 deletions

17
server/pkg/utils/ip.go Normal file
View 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)
}