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.
CI / changes (push) Successful in 4s
CI / go (push) Failing after 6s
CI / bird2 (push) Has been skipped
CI / openapi (push) Has been skipped

This commit is contained in:
Denozordec
2026-04-05 14:07:45 +07:00
parent 272542b92a
commit bf52b21150
131 changed files with 9222 additions and 17 deletions
+47
View File
@@ -0,0 +1,47 @@
package birdfmt
import (
"fmt"
"strings"
)
// ManagedBanner returns a comment block marking EvoBGP-generated files (optional first line in bird.d/*.conf).
func ManagedBanner(revisionHint string) string {
rev := strings.TrimSpace(revisionHint)
var b strings.Builder
b.WriteString("# EvoBGP generated — do not edit by hand.\n")
if rev != "" {
b.WriteString("# Revision: ")
b.WriteString(rev)
b.WriteByte('\n')
}
return b.String()
}
// JoinFragments concatenates non-empty text blocks with a blank line between them.
func JoinFragments(parts ...string) string {
var out []string
for _, p := range parts {
p = strings.TrimSpace(p)
if p == "" {
continue
}
out = append(out, p)
}
if len(out) == 0 {
return ""
}
return strings.Join(out, "\n\n") + "\n"
}
// ValidateIncludePath rejects paths that could break out of the config directory.
func ValidateIncludePath(p string) error {
p = strings.TrimSpace(p)
if p == "" {
return fmt.Errorf("birdfmt: include path is empty")
}
if strings.Contains(p, "..") {
return fmt.Errorf("birdfmt: include path must not contain '..': %q", p)
}
return nil
}