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

@@ -3,6 +3,8 @@ package database
import (
"github.com/luscis/openlan/pkg/libol"
"github.com/ovn-org/libovsdb/ovsdb"
"strconv"
"strings"
)
func PrintError(result []ovsdb.OperationResult) {
@@ -17,3 +19,19 @@ func PrintError(result []ovsdb.OperationResult) {
func GenUUID() string {
return libol.GenString(32)
}
func HasPrefix(value string, index int, dest string) bool {
if len(value) >= index {
return value[:index] == dest
}
return false
}
func GetAddrPort(conn string) (string, int) {
values := strings.SplitN(conn, ":", 2)
if len(values) == 2 {
port, _ := strconv.Atoi(values[1])
return values[0], port
}
return values[0], 0
}