Files
openlan/pkg/config/bridge.go
2024-10-09 14:53:05 +08:00

36 lines
744 B
Go
Executable File

package config
type Bridge struct {
Network string `json:"-" yaml:"-"`
Peer string `json:"peer,omitempty"`
Name string `json:"name,omitempty"`
IPMtu int `json:"mtu,omitempty"`
Address string `json:"address,omitempty"`
Provider string `json:"-" yaml:"-"`
Stp string `json:"stp,omitempty"`
Delay int `json:"delay,omitempty"`
Mss int `json:"tcpMss,omitempty"`
}
func (br *Bridge) Correct() {
if br.Name == "" {
if len(br.Network) > 12 {
br.Name = "br-" + br.Network[:12]
} else {
br.Name = "br-" + br.Network
}
}
if br.Provider == "" {
br.Provider = "linux"
}
if br.IPMtu == 0 {
br.IPMtu = 1500
}
if br.Delay == 0 {
br.Delay = 2
}
if br.Stp == "" {
br.Stp = "enable"
}
}