Skip to content
Permalink
Browse files

Add doc for inline output filtering.

  • Loading branch information...
respawner committed Jul 4, 2019
1 parent 5018608 commit af939dc7dde0c6ea359ec2ffee84194ea1f82617
Showing with 26 additions and 1 deletion.
  1. +5 −0 docs/configuration.md
  2. +21 −1 routers/router.php
@@ -251,6 +251,11 @@ $config['filters']['output'][] = '/^NotToShow/';
Defines filters to eliminate some lines from the output. Do not define any
filters if there is no nothing to filter.

```php
$config['filters']['output'][] = ['/replacethis/', 'withthis'];
```
Defines filters that will replace an matched expression with another one.

```php
// Use the unset command if you don't want to use pre-defined filters
// unset $config['filters']['aspath_regexp'];
@@ -73,7 +73,7 @@ private function sanitize_output($output) {
$valid = true;
foreach ($this->global_config['filters']['output'] as $filter) {
if (gettype($filter) == gettype(array())) {
if (is_array($filter)) {
$line = preg_replace($filter[0], $filter[1], $line);
} else {
// Line has been marked as invalid
@@ -121,6 +121,26 @@ protected function get_source_interface_id($ip_version = 'ipv6') {
return $source_interface_id[$ip_version];
}
protected function has_routing_table_name() {
return isset($this->config['routing-table']);
}
protected function get_routing_table_name($ip_version = 'ipv6') {
// No specific routing table given
if (!$this->has_routing_table_name()) {
return null;
}
$routing_table_names = $this->config['routing-table'];
// Single routing table (IPv4 and IPv6 routes)
if (!is_array($routing_table_names)) {
return $routing_table_names;
}
return $routing_tables_names[$ip_version];
}
protected abstract function build_bgp($parameter);
protected abstract function build_aspath_regexp($parameter);

0 comments on commit af939dc

Please sign in to comment.
You can’t perform that action at this time.