first friend is oasis

This commit is contained in:
qo-op 2020-12-05 00:50:22 +01:00
parent 765741151c
commit e2267718bc
4 changed files with 47 additions and 11 deletions

View File

@ -72,10 +72,20 @@ cd ~/.zen/astroport/zen/jaklis
# BECOME FRIEND with oasis
./jaklis.py like -p 2jQUH4HfHxdTesjCjvMCx1VJgA5AnpuvrWRq1swfRdsS -s 5
# SEND ipfstryme
echo "Restart IPFS"
sudo service ipfs restart
# SEND ipfstryme to oasis
# find IPFSTRYME public address
IPFSNODEID="$PeerID"
mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/G1SSB
echo "" > ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
for tryme in $(ipfs id | jq -r .Addresses[]);
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" >> ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
done
./jaklis.py send -d 2jQUH4HfHxdTesjCjvMCx1VJgA5AnpuvrWRq1swfRdsS -t "ipfstryme" -f ~/.zen/ipfs/.${IPFSNODEID}/tryme.addr
exit 0

View File

@ -83,7 +83,7 @@ export LC_ALL=C.UTF-8 #attipix
export LANG=C.UTF-8 #attipix
# COPY NODE G1SSB ID to IPFS
echo "$G1PUB" > ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.pubkey
echo "$G1PUB" > ~/.zen/ipfs/.${IPFSNODEID}/G1SSB/_g1.pubkey
# IPFS Node PUBLISH Adresses so Pub can become bootstrap for ${g1author}
ipfs id | jq -r .Addresses[] > ~/.zen/ipfs/.${IPFSNODEID}/Addresses

View File

@ -50,11 +50,11 @@ do
friend_of_mine=$(./jaklis.py like -p $liking_me | jq -r '.yours');
# 2. Searching "ipfstryme" message from friend_of_mine
[[ $friend_of_mine != null ]] && echo "Connect to my friend $liking_me" && friend_of_mine_count=$((friend_of_mine_count+1)) && ipfsadd=0 \
&& for adresse in $(./jaklis.py read -n50 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content');
&& for peer in $(./jaklis.py read -n50 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content');
do
# 3. liking_me friend_of_mine can join my swarm & bootstrap
ipfs swarm connect $adresse;
ipfs bootstrap add $adresse;
ipfs swarm connect $peer;
ipfs bootstrap add $peer;
ipfsadd=$((ipfsadd+1))
done;
[[ $friend_of_mine != null && $ipfsadd == 0 ]] && echo "No ipfstryme message..." && echo "$liking_me" >> /tmp/A_liking_me_NO_ipfstryme.txt

View File

@ -43,13 +43,40 @@ rm -Rf /home/$YOU/.zen/ipfs_swarm/.12D3KooW*
rm -Rf /home/$YOU/.zen/ipfs_swarm/*
count=1
########################################################################
# Let's look for Friends and "IPFS swarm connect" with them
########################################################################
cd ~/.zen/astroport/zen/jaklis
# 1. Get Gchange "liking_me" people list
for liking_me in $(./jaklis.py like | jq -r '.likes[].issuer');
do
friend_of_mine=$(./jaklis.py like -p $liking_me | jq -r '.yours');
# 2. Searching "ipfstryme" message from friend_of_mine
[[ $friend_of_mine != null ]] && echo "Connect to my friend $liking_me" && friend_of_mine_count=$((friend_of_mine_count+1)) && ipfsadd=0 \
&& for peer in $(./jaklis.py read -n50 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' | head -n1);
do
id=$(echo "$peer" | awk -F '/' '{print $7}')
[[ "$id" == "" ]] && echo "WARNING! ID empty for $peer " && continue
#### REFRESH ~/.zen/ipfs_swarm/ with /ipns/$id
$MY_PATH/tools/timeout.sh -t 30 ipfs get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$id
ipfsadd=$((ipfsadd+1))
done;
[[ $friend_of_mine != null && $ipfsadd == 0 ]] && echo "No ipfstryme message..." && echo "$liking_me" >> /tmp/A_liking_me_NO_ipfstryme.txt
# 4. liking_me IS NOT a friend_of_mine!!
[[ $friend_of_mine == null ]] && echo "I am NOT LIKING $liking_me";
liking_me_count=$((liking_me_count+1))
done
# Search for All peers Nodes. ## TODO: To be changed when Swarm is too big or not expanding
#for id in $(ls -d ~/.zen/ipfs_swarm/.12D3KooW* | cut -d '.' -f 3); # Alternative search...
for peer in $(ipfs swarm peers);
do
id=$(echo "$peer" | grep 'ip4' | awk -F '/' '{print $7}')
[[ "$id" == "" ]] && id=$(echo "$peer" | grep 'ip6' | awk -F '/' '{print $7}')
[[ "$id" == "" ]] && echo "WARNING! ID empty for $peer " && continue
echo " ($count) Refreshing /home/$YOU/.zen/ipfs_swarm/.$id"
@ -71,7 +98,6 @@ do
continue
fi
$MY_PATH/tools/timeout.sh -t 30 ipfs get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$id
#### IPFS SWARM SHAPING CONTROL
### CHECK Astroport Station Database Coherence?