You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
594 B

  1. #!/bin/sh
  2. . /usr/share/libubox/jshn.sh
  3. . /usr/share/wginstaller/wg_functions.sh
  4. case "$1" in
  5. list)
  6. cmd='{ "get_usage": {},'
  7. cmd=$(echo $cmd ' "register": {"uplink_bw":"10", "mtu":"1400", "public_key": "xyz"} }')
  8. echo $cmd
  9. ;;
  10. call)
  11. case "$2" in
  12. get_usage)
  13. read input
  14. logger -t "wginstaller" "call" "$2" "$input"
  15. wg_get_usage
  16. ;;
  17. register)
  18. read input
  19. logger -t "wginstaller" "call" "$2" "$input"
  20. json_load "$input"
  21. json_get_var uplink_bw uplink_bw
  22. json_get_var mtu mtu
  23. json_get_var public_key public_key
  24. wg_register $uplink_bw $mtu $public_key
  25. ;;
  26. esac
  27. ;;
  28. esac