hardening silkaj connexion
This commit is contained in:
parent
fc63a21702
commit
70784d68d6
|
@ -64,8 +64,8 @@ chmod -R 777 /tmp/zen/
|
|||
find /tmp/zen/ -cmin +5 -type f -name "current.duniter" -exec rm -f '{}' \;
|
||||
[[ -f /tmp/zen/current.duniter ]] && cat /tmp/zen/current.duniter && exit 0
|
||||
|
||||
##### $DIR/duniter_nodes.txt REFRESH after 20 minutes #####
|
||||
find $DIR/ -cmin +20 -type f -name "duniter_*" -exec rm -f '{}' \;
|
||||
##### $DIR/duniter_nodes.txt REFRESH after 10 minutes #####
|
||||
find $DIR/ -cmin +10 -type f -name "duniter_*" -exec rm -f '{}' \;
|
||||
if [[ ! -f $DIR/duniter_nodes.txt ]]; then
|
||||
# Get New BMAS known Nodes list from shuffle one $DIR/good.nodes.txt
|
||||
[[ -f $DIR/good.nodes.txt ]] && DUNITER=$(shuf -n 1 $DIR/good.nodes.txt) || DUNITER="duniter-g1.p2p.legal:443"
|
||||
|
@ -114,14 +114,19 @@ longchain=$(ls -S $DIR/chains/ | head -n 1)
|
|||
cp $DIR/chains/$longchain $DIR/good.nodes.txt
|
||||
|
||||
## TEST if server is really running Duniter
|
||||
Dtest=""; loop=0
|
||||
Dtest=""; IDtest=""; lastresult=""; loop=0
|
||||
while [[ $Dtest != "duniter" ]]; do
|
||||
result=$(shuf -n 1 $DIR/good.nodes.txt)
|
||||
Dtest=$(curl -s https://$result | jq -r .duniter.software)
|
||||
while [[ $lastresult == $result && $loop -lt 7 ]]; do result=$(shuf -n 1 $DIR/good.nodes.txt); ((loop++)); done
|
||||
lastresult=$result
|
||||
Dtest=$(curl -s https://$lastresult | jq -r .duniter.software)
|
||||
## CHECK if server is not too slow
|
||||
[[ $Dtest == "duniter" ]] && IDtest=$(silkaj -p $lastresult id Fred)
|
||||
[[ $IDtest == "" ]] && Dtest=""
|
||||
[[ $loop -eq 8 ]] && result="duniter-g1.p2p.legal:443" && break
|
||||
((loop++))
|
||||
[[ $loop -eq 4 ]] && result="duniter-g1.p2p.legal:443" && break
|
||||
done
|
||||
|
||||
|
||||
echo "$result" > /tmp/zen/current.duniter
|
||||
|
||||
echo $result
|
||||
|
|
Loading…
Reference in New Issue