fea: openudp: update link state

This commit is contained in:
Daniel Ding
2022-10-07 18:56:06 +08:00
parent f354e6d85f
commit c03c099dfb
12 changed files with 362 additions and 103 deletions

View File

@@ -1,6 +1,7 @@
package libol
import (
"net"
"os/exec"
"runtime"
"strings"
@@ -201,3 +202,10 @@ func IpMetricSet(name, metric string, opts ...string) ([]byte, error) {
return nil, NewErr("IpAddrAdd %s notSupport", runtime.GOOS)
}
}
func LookupIP(name string) string {
if addr, _ := net.LookupIP(name); len(addr) > 0 {
return addr[0].String()
}
return ""
}