Updated README.md
This commit is contained in:
parent
7ab9602ee7
commit
7b1699d3ec
|
@ -10,4 +10,4 @@
|
|||
6. Verify everything work by running `cd ~/dn42/dn42-rpki-export.json/ && php roagen.php`.
|
||||
7. In $USER crontab file put `14 */3 * * * cd ~/dn42/dn42-rpki-export.json/ && php roagen.php`. Finetune time between runs to your liking.
|
||||
|
||||
NB: The roagen.php script is written with the paths to the dn42 registry folder being they reside in the same parent folder.
|
||||
NB: The roagen.php script is written with the paths to the dn42 registry folder being both git repositories reside in the same parent folder.
|
||||
|
|
12
roagen.php
12
roagen.php
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
echo shell_exec("/usr/bin/git -C ../dn42-registry/ pull origin master:master 2>&1");
|
||||
echo shell_exec("/usr/bin/git -C ../registry/ pull origin master:master 2>&1");
|
||||
|
||||
function startsWith($haystack, $needle)
|
||||
{
|
||||
|
@ -19,13 +19,13 @@ function endsWith($haystack, $needle)
|
|||
}
|
||||
|
||||
$roas = array();
|
||||
$files = scandir('../dn42-registry/data/route6/');
|
||||
$files = scandir('../registry/data/route6/');
|
||||
$h = 0; // count up when reading new file
|
||||
$i = 0;
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
$handle = fopen("../dn42-registry/data/route6/$file", "r");
|
||||
$handle = fopen("../registry/data/route6/$file", "r");
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
// extract var $ta
|
||||
if (startsWith($line,'source')) {
|
||||
|
@ -39,7 +39,7 @@ foreach($files as $file)
|
|||
$prefix = array();
|
||||
$line2 = explode('6: ', $line);
|
||||
// validate v6 netmasks with following cmd
|
||||
// cmd: ls -1 ../dn42-registry/data/route6/ | egrep -o "\b\_[0-9]+\b" | sed 's/\_//' | sort -n | uniq
|
||||
// cmd: ls -1 ../registry/data/route6/ | egrep -o "\b\_[0-9]+\b" | sed 's/\_//' | sort -n | uniq
|
||||
preg_match('/([a-f0-9\:]{0,128})\/(32|40|4[4-9]|5[0-9]|6[0-4]|80)/', $line2[1], $prefix);
|
||||
$route = $prefix[0];
|
||||
$mask = $prefix[2];
|
||||
|
@ -85,11 +85,11 @@ foreach($files as $file)
|
|||
$h++;
|
||||
}
|
||||
|
||||
$files = scandir('../dn42-registry/data/route/');
|
||||
$files = scandir('../registry/data/route/');
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
$handle = fopen("../dn42-registry/data/route/$file", "r");
|
||||
$handle = fopen("../registry/data/route/$file", "r");
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
// extract var $ta
|
||||
if (startsWith($line,'source')) {
|
||||
|
|
Loading…
Reference in a new issue