|
@@ -47,6 +47,8 @@ prepare_config() {
|
47
|
47
|
mkdir -p /etc/gnunet
|
48
|
48
|
chown gnunet:gnunet /etc/gnunet
|
49
|
49
|
}
|
|
50
|
+
|
|
51
|
+ # defaults paths
|
50
|
52
|
gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
|
51
|
53
|
gnunet-config -c $CONFIGFILE -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
|
52
|
54
|
gnunet-config -c $CONFIGFILE -s identity -o EGODIR -V /etc/gnunet/identity/egos
|
|
@@ -54,19 +56,6 @@ prepare_config() {
|
54
|
56
|
gnunet-config -c $CONFIGFILE -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
|
55
|
57
|
gnunet-config -c $CONFIGFILE -s namestore-sqlite -o FILENAME -V /etc/gnunet/namestore.sqlite
|
56
|
58
|
|
57
|
|
- # minimal datastore (todo: make this configurable)
|
58
|
|
- gnunet-config -c $CONFIGFILE -s datastore -o DATABASE -V heap
|
59
|
|
- gnunet-config -c $CONFIGFILE -s datastore -o QUOTA -V "4 MB"
|
60
|
|
- gnunet-config -c $CONFIGFILE -s fs -o CONTENT_PUSHING -V NO
|
61
|
|
- gnunet-config -c $CONFIGFILE -s fs -o CONTENT_CACHING -V NO
|
62
|
|
-
|
63
|
|
- # limit dhtcache memory usage to 4 MB
|
64
|
|
- gnunet-config -c $CONFIGFILE -s dhtcache -o QUOTA -V "4 MB"
|
65
|
|
-
|
66
|
|
- # enable dns2gns
|
67
|
|
- gnunet-config -c $CONFIGFILE -s dns2gns -o AUTOSTART -V YES
|
68
|
|
- gnunet-config -c $CONFIGFILE -s dns2gns -o FORCESTART -V YES
|
69
|
|
-
|
70
|
59
|
# enable all installed transport plugins
|
71
|
60
|
transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS)
|
72
|
61
|
for transplug in /usr/lib/gnunet/libgnunet_plugin_transport_*.so; do
|
|
@@ -77,18 +66,27 @@ prepare_config() {
|
77
|
66
|
done
|
78
|
67
|
gnunet-config -c $CONFIGFILE -s transport -o PLUGINS -V "$transport_plugins"
|
79
|
68
|
|
80
|
|
- gnunet-config -c $CONFIGFILE -s pt -o FORCESTART -V YES
|
81
|
|
- gnunet-config -c $CONFIGFILE -s exit -o AUTOSTART -V YES
|
82
|
|
- gnunet-config -c $CONFIGFILE -s exit -o FORCESTART -V YES
|
83
|
|
- gnunet-config -c $CONFIGFILE -s exit -o EXIT_IPV4 -V YES
|
84
|
|
- # ssh and www services
|
85
|
|
-# gnunet-config -c $CONFIGFILE -s exit -o EXIT_RANGE_IPV4_POLICY -V "169.254.86.1:22;169.254.86.1:80;"
|
86
|
|
-# gnunet-config -c $CONFIGFILE -s ssh.gnunet. -o TCP_REDIRECTS -V "22:169.254.86.1:22"
|
87
|
|
-# gnunet-config -c $CONFIGFILE -s www.gnunet. -o TCP_REDIRECTS -V "80:169.254.86.1:80"
|
88
|
|
- # iperf (TCP) and echo (UDP) for battlemesh
|
89
|
|
- gnunet-config -c $CONFIGFILE -s exit -o EXIT_RANGE_IPV4_POLICY -V "169.254.86.1:7;169.254.86.1:5201;"
|
90
|
|
- gnunet-config -c $CONFIGFILE -s iperf.gnunet. -o TCP_REDIRECTS -V "5201:169.254.86.1:5201"
|
91
|
|
- gnunet-config -c $CONFIGFILE -s echo.gnunet. -o UDP_REDIRECTS -V "7:169.254.86.1:7"
|
|
69
|
+ # apply config from UCI
|
|
70
|
+ _gnunet_section=""
|
|
71
|
+ config_cb()
|
|
72
|
+ {
|
|
73
|
+ # $1 "Type"
|
|
74
|
+ # $2 "Name"
|
|
75
|
+ local __TYPE="$1"
|
|
76
|
+ local __NAME="$2"
|
|
77
|
+ [ "${__TYPE}" = "gnunet-config" ] && _gnunet_section="${__NAME}"
|
|
78
|
+ [ "${__TYPE}" = "gnunet-exit-service" ] && _gnunet_section="${__NAME}.gnunet."
|
|
79
|
+ }
|
|
80
|
+ option_cb() {
|
|
81
|
+ # $1 name of variable
|
|
82
|
+ # $2 value
|
|
83
|
+ local __OPT="$1"
|
|
84
|
+ local __VAL="$2"
|
|
85
|
+ gnunet-config -c $CONFIGFILE -s ${_gnunet_section} -o ${__OPT} -V "${__VAL}"
|
|
86
|
+ }
|
|
87
|
+ config_load gnunet
|
|
88
|
+
|
|
89
|
+ return 0
|
92
|
90
|
}
|
93
|
91
|
|
94
|
92
|
start_service() {
|