2024-11-11 16:23:45 +08:00
|
|
|
//go:build unix
|
|
|
|
|
2024-10-29 15:28:58 +08:00
|
|
|
package libbox
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// copied from net.linkFlags
|
|
|
|
func linkFlags(rawFlags uint32) net.Flags {
|
|
|
|
var f net.Flags
|
|
|
|
if rawFlags&syscall.IFF_UP != 0 {
|
|
|
|
f |= net.FlagUp
|
|
|
|
}
|
|
|
|
if rawFlags&syscall.IFF_RUNNING != 0 {
|
|
|
|
f |= net.FlagRunning
|
|
|
|
}
|
|
|
|
if rawFlags&syscall.IFF_BROADCAST != 0 {
|
|
|
|
f |= net.FlagBroadcast
|
|
|
|
}
|
|
|
|
if rawFlags&syscall.IFF_LOOPBACK != 0 {
|
|
|
|
f |= net.FlagLoopback
|
|
|
|
}
|
|
|
|
if rawFlags&syscall.IFF_POINTOPOINT != 0 {
|
|
|
|
f |= net.FlagPointToPoint
|
|
|
|
}
|
|
|
|
if rawFlags&syscall.IFF_MULTICAST != 0 {
|
|
|
|
f |= net.FlagMulticast
|
|
|
|
}
|
|
|
|
return f
|
|
|
|
}
|