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`.
|
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.
|
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
|
<?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)
|
function startsWith($haystack, $needle)
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,13 @@ function endsWith($haystack, $needle)
|
||||||
}
|
}
|
||||||
|
|
||||||
$roas = array();
|
$roas = array();
|
||||||
$files = scandir('../dn42-registry/data/route6/');
|
$files = scandir('../registry/data/route6/');
|
||||||
$h = 0; // count up when reading new file
|
$h = 0; // count up when reading new file
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
{
|
{
|
||||||
$handle = fopen("../dn42-registry/data/route6/$file", "r");
|
$handle = fopen("../registry/data/route6/$file", "r");
|
||||||
while (($line = fgets($handle)) !== false) {
|
while (($line = fgets($handle)) !== false) {
|
||||||
// extract var $ta
|
// extract var $ta
|
||||||
if (startsWith($line,'source')) {
|
if (startsWith($line,'source')) {
|
||||||
|
@ -39,7 +39,7 @@ foreach($files as $file)
|
||||||
$prefix = array();
|
$prefix = array();
|
||||||
$line2 = explode('6: ', $line);
|
$line2 = explode('6: ', $line);
|
||||||
// validate v6 netmasks with following cmd
|
// 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);
|
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];
|
$route = $prefix[0];
|
||||||
$mask = $prefix[2];
|
$mask = $prefix[2];
|
||||||
|
@ -85,11 +85,11 @@ foreach($files as $file)
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$files = scandir('../dn42-registry/data/route/');
|
$files = scandir('../registry/data/route/');
|
||||||
|
|
||||||
foreach($files as $file)
|
foreach($files as $file)
|
||||||
{
|
{
|
||||||
$handle = fopen("../dn42-registry/data/route/$file", "r");
|
$handle = fopen("../registry/data/route/$file", "r");
|
||||||
while (($line = fgets($handle)) !== false) {
|
while (($line = fgets($handle)) !== false) {
|
||||||
// extract var $ta
|
// extract var $ta
|
||||||
if (startsWith($line,'source')) {
|
if (startsWith($line,'source')) {
|
||||||
|
|
Loading…
Reference in a new issue