Files
openlan/pkg/config/bridge.go
Daniel Ding d610db9c88
Some checks failed
Coverage CI / build (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
Ubuntu CI / build (push) Has been cancelled
fix: share routes for host network.
2025-05-12 09:58:43 +08:00

35 lines
839 B
Go
Executable File

package config
type Bridge struct {
Network string `json:"-" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
IPMtu int `json:"mtu,omitempty" yaml:"mtu,omitempty"`
Address string `json:"address,omitempty" yaml:"address,omitempty"`
Provider string `json:"-" yaml:"-"`
Stp string `json:"stp,omitempty" yaml:"stp,omitempty"`
Delay int `json:"delay,omitempty" yaml:"delay,omitempty"`
Mss int `json:"tcpMss,omitempty" yaml:"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"
}
}