diff options
-rwxr-xr-x | bin/ak-cjdns-scanner | 17 | ||||
-rwxr-xr-x | config.sh | 1 | ||||
-rwxr-xr-x | init.sh | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/bin/ak-cjdns-scanner b/bin/ak-cjdns-scanner index b7dd53c..aee1fd2 100755 --- a/bin/ak-cjdns-scanner +++ b/bin/ak-cjdns-scanner @@ -6,17 +6,28 @@ # counter=0 printf '[' > walk.aknet -dumpLinks | cut -d ' ' -f 2,4 | sed 's/ /\n/g' | sort | uniq | while read -r ip || [ -n "$ip" ] +dumpLinks \ + | cut -d ' ' -f 2,4 \ + | sed 's/ /\n/g' \ + | sort \ + | uniq \ + | while read -r ip || [ -n "$ip" ] do - akid="`curl --connect-timeout 3 "http://[$(publictoip6 $ip)]:8610/v0/akid" 2>/dev/null`" + akid="`curl \ + -A 'akd/0.1.0; https://github.com/arching-kaos' \ + --connect-timeout 3 \ + "http://[$(publictoip6 $ip)]:8610/v0/akid" 2>/dev/null`" if [ "$?" == "0" ] then if [ "$counter" -ne "0" ] then printf ',' >> walk.aknet fi - printf '{"cjdnsPublicKey":"%s","cjdnsIp":"%s","akid":%s}' "$ip" "`publictoip6 $ip`" "$akid" >> walk.aknet + printf '{"cjdnsPublicKey":"%s","cjdnsIp":"%s","akid":%s}' \ + "$ip" "`publictoip6 $ip`" "$akid" >> walk.aknet counter="`expr $counter + 1`" fi done printf ']' >> walk.aknet + +mv walk.aknet $AK_ZPEERSFILE @@ -22,5 +22,6 @@ export AK_FINGERPRINT="$(gpg2 --homedir $AK_GPGHOME --list-keys | grep kaos@kaos export AK_MINEDBLOCKSDIR="$AK_WORKDIR/mined_blocks" export AK_ZBLOCKSFILE="$AK_WORKDIR/zBlocksFile" export AK_ZPAIRSFILE="$AK_WORKDIR/pairsFile" +export AK_ZPEERSFILE="$AK_WORKDIR/peersFile" export AK_CACHEDIR="$AK_WORKDIR/cache" @@ -66,6 +66,9 @@ if [ ! -f $AK_ZCHAINASC ] ; then gpg2 --homedir $AK_GPGHOME -bao $AK_ZCHAINASC $ if [ ! -f $AK_ZZCHAIN ] ; then printf "%s" "$(ipfs add -q $AK_ZCHAINASC)" > $AK_ZZCHAIN;fi if [ ! -f $AK_GENESISASC ] ; then gpg2 --homedir $AK_GPGHOME -bao $AK_GENESISASC $AK_GENESIS;fi if [ ! -f $AK_ZGENESISASC ] ; then printf "%s" "$(ipfs add -q $AK_GENESISASC)" > $AK_ZGENESISASC;fi +if [ ! -f $AK_ZBLOCKSFILE ] ; then printf "[]" > $AK_ZBLOCKSFILE;fi +if [ ! -f $AK_ZPAIRSFILE ] ; then printf "[]" > $AK_ZPAIRSFILE;fi +if [ ! -f $AK_ZPEERSFILE ] ; then printf "[]" > $AK_ZPEERSFILE;fi ipfs_zarchive_check_or_mkdir |