mirror of
https://github.com/luscis/openlan.git
synced 2025-10-05 16:47:11 +08:00
fea:support nexthop group for routing ha (#57)
This commit is contained in:
@@ -18,6 +18,10 @@ type MultiPath struct {
|
||||
Weight int `json:"weight"`
|
||||
}
|
||||
|
||||
func (mp *MultiPath) CompareEqual(b MultiPath) bool {
|
||||
return mp.NextHop == b.NextHop
|
||||
}
|
||||
|
||||
type PrefixRoute struct {
|
||||
File string `json:"-"`
|
||||
Network string `json:"network,omitempty"`
|
||||
@@ -26,6 +30,7 @@ type PrefixRoute struct {
|
||||
MultiPath []MultiPath `json:"multipath,omitempty"`
|
||||
Metric int `json:"metric"`
|
||||
Mode string `json:"forward,omitempty"` // route or snat
|
||||
NextGroup string `json:"nextgroup,omitempty"`
|
||||
}
|
||||
|
||||
func (r *PrefixRoute) String() string {
|
||||
@@ -55,6 +60,7 @@ func (r *PrefixRoute) CorrectRoute(nexthop string) {
|
||||
if r.Mode == "" {
|
||||
r.Mode = "snat"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func CorrectRoutes(routes []PrefixRoute, nexthop string) {
|
||||
|
Reference in New Issue
Block a user