mirror of
https://github.com/luscis/openlan.git
synced 2025-10-21 16:10:05 +08:00
fea: switch: support router network
This commit is contained in:
@@ -10,6 +10,7 @@ type Subnet struct {
|
||||
Start string `json:"startAt,omitempty"`
|
||||
End string `json:"endAt,omitempty"`
|
||||
Netmask string `json:"netmask,omitempty"`
|
||||
CIDR string `json:"cidr,omitempty"`
|
||||
}
|
||||
|
||||
type MultiPath struct {
|
||||
@@ -44,6 +45,20 @@ func (r *PrefixRoute) String() string {
|
||||
return fmt.Sprintf("{%s}", strings.Join(elems, " "))
|
||||
}
|
||||
|
||||
func CorrectRoutes(routes []PrefixRoute, nexthop string) {
|
||||
for i := range routes {
|
||||
if routes[i].Metric == 0 {
|
||||
routes[i].Metric = 660
|
||||
}
|
||||
if routes[i].NextHop == "" {
|
||||
routes[i].NextHop = nexthop
|
||||
}
|
||||
if routes[i].Mode == "" {
|
||||
routes[i].Mode = "snat"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type HostLease struct {
|
||||
Network string `json:"network,omitempty"`
|
||||
Hostname string `json:"hostname"`
|
||||
|
Reference in New Issue
Block a user