mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
30 lines
497 B
Go
30 lines
497 B
Go
package openbgpd
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/alice-lg/alice-lg/pkg/api"
|
|
)
|
|
|
|
// Config is a OpenBGPD source config
|
|
type Config struct {
|
|
ID string
|
|
Name string
|
|
|
|
CacheTTL time.Duration
|
|
RoutesCacheSize int
|
|
|
|
API string `ini:"api"`
|
|
|
|
RejectCommunities api.Communities
|
|
}
|
|
|
|
// APIURL creates an url from the config
|
|
func (cfg *Config) APIURL(path string, params ...interface{}) string {
|
|
u := strings.TrimSuffix(cfg.API, "/")
|
|
u += fmt.Sprintf(path, params...)
|
|
return u
|
|
}
|