summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-yggdrasil/root/usr/libexec
diff options
context:
space:
mode:
authorWilliam Fleurant <meshnet@protonmail.com>2023-11-11 20:16:20 +0100
committerWilliam Fleurant <meshnet@protonmail.com>2023-11-11 20:16:20 +0100
commit6395c4d7a6f60618a83fcd35bf6850d2ab157470 (patch)
tree75fe0115e8d38fca211015c34398297ec7f9f7b6 /protocols/luci-proto-yggdrasil/root/usr/libexec
parente8029b08287c666a43d5ef25c7ea83ce7d606903 (diff)
luci-proto-yggdrasil: yggdrasil now supported by netifd
- this package replaces luci-app-yggdrasil Signed-off-by: William Fleurant <meshnet@protonmail.com>
Diffstat (limited to 'protocols/luci-proto-yggdrasil/root/usr/libexec')
-rwxr-xr-xprotocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil36
1 files changed, 36 insertions, 0 deletions
diff --git a/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil b/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil
new file mode 100755
index 0000000000..921195f65f
--- /dev/null
+++ b/protocols/luci-proto-yggdrasil/root/usr/libexec/rpcd/luci.yggdrasil
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+case "$1" in
+ list)
+ json_init
+ json_add_object "generateKeyPair"
+ json_close_object
+ json_add_object "getPeers"
+ json_add_string "interface"
+ json_close_object
+ json_dump
+ ;;
+ call)
+ case "$2" in
+ generateKeyPair)
+ json_load "$(yggdrasil -genconf -json)"
+ json_get_vars PublicKey PrivateKey
+ json_cleanup
+ json_init
+ json_add_object "keys"
+ json_add_string "priv" "$PrivateKey"
+ json_add_string "pub" "$PublicKey"
+ json_close_object
+ json_dump
+ ;;
+ getPeers)
+ read -r input
+ json_load "$input"
+ json_get_vars interface
+ echo "$(yggdrasilctl -endpoint=unix:///tmp/yggdrasil/${interface}.sock -json getPeers)"
+ ;;
+ esac
+ ;;
+esac