mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 00:57:03 +08:00
fea: openudp: update link state
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Switch struct {
|
||||
UUID string `ovsdb:"_uuid" json:"uuid"`
|
||||
Protocol string `ovsdb:"protocol" json:"protocol"`
|
||||
@@ -32,6 +36,19 @@ type VirtualLink struct {
|
||||
Status map[string]string `ovsdb:"status" json:"status"`
|
||||
}
|
||||
|
||||
func (l *VirtualLink) IsUdpIn() bool {
|
||||
if HasPrefix(l.Device, 4, "spi:") &&
|
||||
HasPrefix(l.Connection, 4, "udp:") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (l *VirtualLink) Spi() uint32 {
|
||||
spi, _ := strconv.Atoi(l.Device[4:])
|
||||
return uint32(spi)
|
||||
}
|
||||
|
||||
type OpenVPN struct {
|
||||
UUID string `ovsdb:"_uuid" json:"uuid"`
|
||||
Protocol string `ovsdb:"protocol" json:"protocol"`
|
||||
|
Reference in New Issue
Block a user