better quality ipfstryme

This commit is contained in:
qo-op 2021-06-04 02:02:04 +02:00
parent fba22ba2e3
commit cc766b6ca8
1 changed files with 16 additions and 19 deletions

View File

@ -33,28 +33,25 @@ touch ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
for tryme in $(ipfs id | jq -r .Addresses[]); for tryme in $(ipfs id | jq -r .Addresses[]);
do do
isLAN=$(echo $tryme | cut -f3 -d '/' | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") isLAN=$(echo $tryme | cut -f3 -d '/' | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
[[ ! $isLAN ]] && echo "$tryme" >> ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr && echo "$tryme" [[ ! $isLAN ]] && echo "$tryme" >> ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr && echo "$tryme"
done done
# Now adding "ipfs swarm peers" to ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr ## Add "liking me" in "swarm peers" station
for tryme in $(ipfs swarm peers); if [[ -f /tmp/liking_me ]]; then
do for liking_me in $(cat /tmp/liking_me);
ipfsnodeid=$(echo $tryme | rev | cut -d '/' -f 1 | rev) do
isMySWARM=$(cat ~/.zen/A_my_swarm.txt | grep $ipfsnodeid ) ipfsnodeid=$(~/.zen/astrXbian/zen/tools/g1_to_ipfs.py $liking_me)
isLAN=$(echo $tryme | cut -f3 -d '/' | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ -f /tmp/ipfs_swarm_peers ]] && ipfsaddress=$(cat /tmp/ipfs_swarm_peers | grep $ipfsnodeid | tail -n 1)
[[ ! $isLAN ]] && [[ $isMySWARM ]] && echo "$tryme" >> ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr && echo "$tryme" || ipfs swarm disconnect /ipfs/$ipfsnodeid if [[ $ipfsaddress ]]; then
done nodeip=$(echo $ipfsaddress | cut -d '/' -f 3)
IsLAN=$(echo $nodeip | grep -E "(^127\.)|(^192\.168\.)|(^fd42\:)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/" )
# REMOVE ipv6 address for in LAN node [[ ! $IsLAN ]] && echo "$ipfsaddress" >> ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
if [[ $IamInLAN ]]; then fi
cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr | grep -Ev "ip6" > /tmp/tryme.addr done
cp -f /tmp/tryme.addr ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
fi fi
# UNIQ TOUT CA # REFRESH ~/.zen/A_my_swarm.txt
cat ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr | sort | uniq > /tmp/tryme.addr cp -f ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr ~/.zen/A_my_swarm.txt
cp -f /tmp/tryme.addr ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
rm -f /tmp/tryme.addr
exit 0 exit 0