add public peers registry to not abuse third party yggdrasil nodes by traffic usage

This commit is contained in:
ghost 2023-09-19 21:43:53 +03:00
parent 041bddffa1
commit 4c041ffb03
4 changed files with 49 additions and 4 deletions

9
.gitignore vendored
View File

@ -6,10 +6,11 @@
/src/public/api/*.json
/src/config/
!/src/config/bootstrap.php
!/src/config/nodes.php
!/src/config/trackers.php
/src/config/*
!/src/config/bootstrap.json
!/src/config/nodes.json
!/src/config/trackers.json
!/src/config/peers.json
/src/public/sitemap.xml

7
src/config/peers.json Normal file
View File

@ -0,0 +1,7 @@
[
{
"description":"YGGtracker public peer instance without traffic limit",
"url":"http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yggstate",
"address":"tls://94.140.114.241:4708"
}
]

View File

@ -193,6 +193,7 @@ try
],
'trackers' => (object) json_decode(file_get_contents(__DIR__ . '/../../config/trackers.json')),
'nodes' => (object) json_decode(file_get_contents(__DIR__ . '/../../config/nodes.json')),
'peers' => (object) json_decode(file_get_contents(__DIR__ . '/../../config/peers.json')),
];
/// Dump feed

View File

@ -457,6 +457,42 @@ else if (is_null($user->public))
<?php } ?>
<?php } ?>
</tr>
<tr>
<td class="padding-y-8 padding-b-8 border-bottom-default text-right" colspan="2">
<?php echo _('Peers') ?>
<a href="https://github.com/YGGverse/YGGtracker/blob/main/src/config/peers.json" title="<?php echo _('Add') ?>">
<sub class="margin-l-4">
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>
</svg>
</sub>
</a>
</td>
<?php foreach (json_decode(file_get_contents(__DIR__ . '/../config/peers.json')) as $i => $peer) { ?>
<tr>
<td class="padding-t-16"><?php echo sprintf('#%s', $i + 1) ?></td>
</tr>
<?php foreach ($peer as $key => $value) { ?>
<?php if ($value) { ?>
<tr>
<td>
<span class="margin-l-16"><?php echo $key ?></span>
</td>
<?php if ($key == 'description') { ?>
<td><?php echo $value ?></td>
<?php } else { ?>
<td class="font-size-10">
<a href="<?php echo $value ?>">
<?php echo $value ?>
</a>
</td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
</tr>
</tbody>
</table>
<?php } else { ?>