mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 09:06:54 +08:00
fea: openudp: update link state
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user