1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

use regular expressions for pipe protocol naming

This commit is contained in:
Matthias Hannig 2017-07-14 15:48:46 +02:00
parent d5f9f7b94f
commit 4108049d1b
2 changed files with 9 additions and 8 deletions

View file

@ -202,12 +202,13 @@ func RoutesNoExport(protocol string) (Parsed, bool) {
// In case we have a multi table setup, we have to query
// the pipe protocol.
if ParserConf.PerPeerTables &&
strings.HasPrefix(protocol, ParserConf.PeerProtocolPrefix) {
if ParserConf.PerPeerTables {
// Replace prefix
protocol = ParserConf.PipeProtocolPrefix +
protocol[len(ParserConf.PeerProtocolPrefix):]
protocol = TemplateExpand(
ParserConf.PipeProtocolMatch,
ParserConf.PipeProtocolTemplate,
protocol,
)
}
return RunAndParse("route noexport '"+protocol+"' all",

View file

@ -18,9 +18,9 @@ type BirdConfig struct {
type ParserConfig struct {
FilterFields []string `toml:"filter_fields"`
PerPeerTables bool `toml:"per_peer_tables"`
PeerProtocolPrefix string `toml:"peer_protocol_prefix"`
PipeProtocolPrefix string `toml:"pipe_protocol_prefix"`
PerPeerTables bool `toml:"per_peer_tables"`
PeerProtocolMatch string `toml:"peer_protocol_match"`
PipeProtocolTemplate string `toml:"pipe_protocol_template"`
}
type RateLimitConfig struct {