1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

30 lines
497 B
Go
Raw Normal View History

2021-03-24 14:26:46 +01:00
package openbgpd
2021-04-26 22:01:26 +02:00
import (
"fmt"
"strings"
2021-07-05 16:21:46 +02:00
"time"
2021-09-15 17:08:53 +02:00
"github.com/alice-lg/alice-lg/pkg/api"
2021-04-26 22:01:26 +02:00
)
2021-03-24 14:26:46 +01:00
// Config is a OpenBGPD source config
type Config struct {
ID string
Name string
CacheTTL time.Duration
RoutesCacheSize int
2021-07-05 16:21:46 +02:00
2021-03-24 14:26:46 +01:00
API string `ini:"api"`
2021-09-15 17:08:53 +02:00
RejectCommunities api.Communities
2021-03-24 14:26:46 +01:00
}
2021-04-26 22:01:26 +02:00
// APIURL creates an url from the config
func (cfg *Config) APIURL(path string, params ...interface{}) string {
2021-10-15 17:39:09 +02:00
u := strings.TrimSuffix(cfg.API, "/")
2021-04-26 22:01:26 +02:00
u += fmt.Sprintf(path, params...)
return u
}