Skip to content

Commit

Permalink
add configurable RTR server
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Oct 13, 2020
1 parent 3b72cc7 commit 5e11424
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ bcg uses RFC 8092 BGP Large Communities
| router-id | Router ID of this router |
| prefixes | List of prefixes to originate |
| irrdb | IRRDB to query prefix sets from (default is rr.ntt.net which includes generated route objects from RPKI ROAs) |
| rtrserver | IP address or hostname of RPKI RTR server (default is 127.0.0.1) |
| peers | Map of name to peer (see below) |
#### Peer Configuration Options
Expand Down
17 changes: 12 additions & 5 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ type Peer struct {

// Config contains global configuration about this router and BCG instance
type Config struct {
Asn uint32 `yaml:"asn" toml:"ASN" json:"asn"`
RouterId string `yaml:"router-id" toml:"Router-ID" json:"router-id"`
Prefixes []string `yaml:"prefixes" toml:"Prefixes" json:"prefixes"`
Peers map[string]*Peer `yaml:"peers" toml:"Peers" json:"peers"`
IrrDb string `yaml:"irrdb" toml:"IRRDB" json:"irrdb"`
Asn uint32 `yaml:"asn" toml:"ASN" json:"asn"`
RouterId string `yaml:"router-id" toml:"Router-ID" json:"router-id"`
Prefixes []string `yaml:"prefixes" toml:"Prefixes" json:"prefixes"`
Peers map[string]*Peer `yaml:"peers" toml:"Peers" json:"peers"`
IrrDb string `yaml:"irrdb" toml:"IRRDB" json:"irrdb"`
RtrServer string `yaml:"rtrserver" toml:"RPKIServer" json:"rtrserver"`
}

// PeerTemplate contains a peer-specific config sent to template
Expand Down Expand Up @@ -270,6 +271,12 @@ func main() {
}
log.Infof("Using IRRDB server %s", config.IrrDb)

// Set default RTR server
if config.RtrServer == "" {
config.RtrServer = "127.0.0.1"
}
log.Infof("Using IRRDB server %s", config.IrrDb)

// Validate Router ID in dotted quad format
if net.ParseIP(config.RouterId).To4() == nil {
log.Fatalf("Router ID %s is not in valid dotted quad notation", config.RouterId)
Expand Down
2 changes: 1 addition & 1 deletion templates/global.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protocol rpki {
roa6 { table rpki6; };

transport tcp;
remote "127.0.0.1" port 8282;
remote "{{ .Config.RtrServer }}" port 8282;

retry keep 90;
refresh keep 900;
Expand Down

0 comments on commit 5e11424

Please sign in to comment.