peering peers only the one who sync

This commit is contained in:
fred 2021-09-11 01:44:15 +02:00
parent d74b7528b5
commit e2dea7e5af
1 changed files with 11 additions and 11 deletions

View File

@ -114,17 +114,6 @@ do
fi
fi
################################################################
echo "@@ CREATING Peering.Peer @@"
echo "jq '.Peering.Peers? += { \"Addrs\": [], \"ID\": \"'$ipfsnodeid'\" }'"
################################################################
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
IsAlreadythere=$(cat ~/.ipfs/config.new | grep '"$ipfsnodeid"') && echo $IsAlreadythere
if [[ ! $IsAlreadythere ]]; then
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
#jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
jq '.Peering.Peers[.Peering.Peers| length] |= . + { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
fi
################################################################
## Refresh bootstrap if XID exists
[[ "$XID" != "" ]] && ipfs bootstrap rm "/ipfs/$ipfsnodeid" && ipfs bootstrap add "$peerline" || ipfs bootstrap rm "$peerline"
################################################################
@ -139,6 +128,17 @@ do
echo "TIMEOUT REACHED ___ SHOULD I REMOVE $ipfsnodeid FROM ~/.zen/A_my_swarm.txt? DO NOTHING";
else
################################################################
echo "@@ CREATING Peering.Peer @@"
echo "jq '.Peering.Peers? += { \"Addrs\": [], \"ID\": \"'$ipfsnodeid'\" }'"
################################################################
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
IsAlreadythere=$(cat ~/.ipfs/config.new | grep '"$ipfsnodeid"') && echo $IsAlreadythere
if [[ ! $IsAlreadythere ]]; then
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
#jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
jq '.Peering.Peers[.Peering.Peers| length] |= . + { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
fi
################################################################
echo "## REFRESH stargates keys from my friend"
################################################################
mkdir -p ~/.zen/key/stargates/$whoisg1