aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README8
-rwxr-xr-xbin/ak-network8
-rwxr-xr-xlib/_ak_ipfs6
-rwxr-xr-xlib/_ak_network2
-rwxr-xr-xlib/_ak_network_stellar43
5 files changed, 32 insertions, 35 deletions
diff --git a/README b/README
index 246acbc..7323655 100644
--- a/README
+++ b/README
@@ -334,10 +334,10 @@ $ ak network
#
# Usage:
#
-# -h, --help Prints this help message
-# -c, --connect [ipfs|cjdns] Connect to network(s)
-# -p, --peers [ipfs|cjdns|stellar|yggdrasil] Outputs peers found
-# -s, --scan [ipfs|cjdns|stellar|yggdrasil] Scan network(s) for peers
+# -h, --help Prints this help message
+# -c, --connect [ipfs|cjdns] Connect to network(s)
+# -p, --peers [ipfs|cjdns|stellar|yggdrasil|incoming] Outputs peers found
+# -s, --scan [ipfs|cjdns|stellar|yggdrasil|incoming] Scan network(s) for peers
#
# Bonus: CJDNS network scanning modes
#
diff --git a/bin/ak-network b/bin/ak-network
index 8877760..9873d12 100755
--- a/bin/ak-network
+++ b/bin/ak-network
@@ -22,10 +22,10 @@
##
## Usage:
##
-## -h, --help Prints this help message
-## -c, --connect [ipfs|cjdns] Connect to network(s)
-## -p, --peers [ipfs|cjdns|stellar|yggdrasil] Outputs peers found
-## -s, --scan [ipfs|cjdns|stellar|yggdrasil|incoming] Scan network(s) for peers
+## -h, --help Prints this help message
+## -c, --connect [ipfs|cjdns] Connect to network(s)
+## -p, --peers [ipfs|cjdns|stellar|yggdrasil|incoming] Outputs peers found
+## -s, --scan [ipfs|cjdns|stellar|yggdrasil|incoming] Scan network(s) for peers
##
## Bonus: CJDNS network scanning modes
##
diff --git a/lib/_ak_ipfs b/lib/_ak_ipfs
index eb4ee31..d904645 100755
--- a/lib/_ak_ipfs
+++ b/lib/_ak_ipfs
@@ -116,7 +116,7 @@ function _ak_ipfs_scanner(){
function _ak_ipfs_add(){
if [ -z $1 ] || [ ! -n "$1" ]
then
- _ak_log_error "no argument given"
+ _ak_log_error "_ak_ipfs_add: no argument given"
exit 1
fi
# Receives a file
@@ -132,7 +132,7 @@ function _ak_ipfs_add(){
function _ak_ipfs_block_stat(){
if [ -z $1 ] || [ ! -n "$1" ]
then
- _ak_log_error "no argument given"
+ _ak_log_error "_ak_ipfs_block_stat: no argument given"
exit 1
fi
_ak_ipfs block stat "$1"
@@ -256,7 +256,7 @@ function _ak_ipfs_get(){
function _ak_ipfs_cat(){
if [ -z $1 ] || [ ! -n "$1" ]
then
- _ak_log_error "no argument given"
+ _ak_log_error "_ak_ipfs_cat: no argument given"
exit 1
fi
if [ ! -f $AK_IPFS_ARTIFACTS/$1 ]
diff --git a/lib/_ak_network b/lib/_ak_network
index 0c0fc6f..a7ef4fc 100755
--- a/lib/_ak_network
+++ b/lib/_ak_network
@@ -55,7 +55,7 @@ function _ak_network_show_peers(){
* ) _ak_log_error "Unknown network $1";exit 1;;
esac
else
- (_ak_network_stellar_show_peers; _ak_network_cjdns_show_peers; _ak_network_yggdrasil_show_peers; _ak_network_ipfs_show_peers) | \
+ (_ak_network_stellar_show_peers; _ak_network_cjdns_show_peers; _ak_network_yggdrasil_show_peers; _ak_network_incoming_show_peers) | \
jq -j | \
sed -e 's/]\[/,/g' | \
jq
diff --git a/lib/_ak_network_stellar b/lib/_ak_network_stellar
index 04ce29b..5d739ec 100755
--- a/lib/_ak_network_stellar
+++ b/lib/_ak_network_stellar
@@ -19,6 +19,15 @@
###
source $AK_LIBDIR/_ak_log
source $AK_LIBDIR/_ak_ipfs
+source $AK_LIBDIR/_ak_script
+
+stellarPeersDir="$AK_ZPEERSDIR/stellar"
+_ak_check_and_create_dir $stellarPeersDir
+
+stellarParticipants="$stellarPeersDir/trustlines"
+_ak_let_there_be_file $stellarParticipants
+stellarParticipantsOnline="$stellarPeersDir/configured.trustlines"
+_ak_let_there_be_file $stellarParticipantsOnline
function _ak_network_stellar_show_ids(){
i=0
@@ -73,24 +82,8 @@ function _ak_network_stellar_scan(){
tempdir=`_ak_make_temp_directory`
tempfile="$tempdir/tmp"
tempaddr="$tempdir/tmpaddr"
- stellarParticipants="$AK_WORKDIR/stellar-network-participants"
- stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online"
- if [ ! -f "$stellarParticipants" ]
- then
- touch $stellarParticipants
- fi
- if [ ! -f "$stellarParticipantsOnline" ]
- then
- touch $stellarParticipantsOnline
- fi
- if [ ! -f "$tempdir" ]
- then
- touch $tempdir
- fi
- if [ ! -f "$tempaddr" ]
- then
- touch $tempaddr
- fi
+ _ak_let_there_be_file $tempdir
+ _ak_let_there_be_file $tempaddr
if [ ! -z $1 ] && [ "$1" == "-l" ] && [ ! -z $2 ]
then
limit=$2
@@ -135,8 +128,6 @@ function _ak_network_stellar_scan(){
}
function _ak_network_stellar_show_peers(){
- stellarParticipants="$AK_WORKDIR/stellar-network-participants"
- stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online"
if [ -f "${stellarParticipantsOnline}" ]
then
(
@@ -150,10 +141,16 @@ function _ak_network_stellar_show_peers(){
fi
counter=$(( $counter + 1 ))
akConfigHash="$(_ak_ipfs_name_resolve /ipns/$akConfig|cut -d '/' -f 3)"
- printf '{"stellar":{"address":"%s","config":"%s"},"node_info":%s}' \
+ printf '{"stellar":{"address":"%s","config":"%s"}' \
"$stellarAddress" \
- "$akConfig" \
- "$(_ak_ipfs_cat $akConfigHash)"
+ "$akConfig"
+ if [ -n "$akConfigHash" ]
+ then
+ printf ',"node_info":%s}' \
+ "$(_ak_ipfs_cat $akConfigHash)"
+ else
+ printf '}'
+ fi
done
printf ']'
) | sed -e 's/\[]//g' #| jq