feat: enhance evobgp with new command-line tools for bundle management, including pull, verify, and apply functionalities. Update go.mod to include necessary dependencies and complete todos in architecture plan for improved observability and deployment practices.
This commit is contained in:
@@ -37,3 +37,34 @@ func RenderStaticIPv4Protocol(protocolName string, prefixes []netip.Prefix) stri
|
||||
b.WriteString("}\n")
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// RenderStaticIPv6Protocol renders a BIRD 2 `protocol static` block for IPv6 prefixes.
|
||||
func RenderStaticIPv6Protocol(protocolName string, prefixes []netip.Prefix) string {
|
||||
if protocolName == "" {
|
||||
protocolName = "evobgp_static_v6"
|
||||
}
|
||||
uniq := make(map[string]netip.Prefix)
|
||||
for _, p := range prefixes {
|
||||
if !p.Addr().Is6() {
|
||||
continue
|
||||
}
|
||||
uniq[p.String()] = p.Masked()
|
||||
}
|
||||
keys := make([]string, 0, len(uniq))
|
||||
for k := range uniq {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
var b strings.Builder
|
||||
b.WriteString("protocol static ")
|
||||
b.WriteString(protocolName)
|
||||
b.WriteString(" {\n ipv6;\n")
|
||||
for _, k := range keys {
|
||||
b.WriteString(" route ")
|
||||
b.WriteString(k)
|
||||
b.WriteString(" unreachable;\n")
|
||||
}
|
||||
b.WriteString("}\n")
|
||||
return b.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user