1 .
/usr
/share
/libubox
/jshn.sh
8 ret
=$
(curl https
://$ip/ubus
-d "$req") 2>/dev
/null
15 if [ $
(uci get wgclient.@client
[0].try_insecure
) == '1' ]; then
16 ret
=$
(curl
--insecure https
://$ip/ubus
-d "$req") 2>/dev
/null
24 if [ $
(uci get wgclient.@client
[0].try_http
) == '1' ]; then
25 ret
=$
(curl http
://$ip/ubus
-d "$req") 2>/dev
/null
41 json_add_string
"jsonrpc" "2.0"
43 json_add_string
"method" "call"
44 json_add_array
"params"
45 json_add_string
"" "00000000000000000000000000000000"
46 json_add_string
"" "session"
47 json_add_string
"" "login"
49 json_add_string
"username" $user
50 json_add_string
"password" $password
54 ret
=$
(query_gw
$ip "$req") 2>/dev
/null
59 json_get_vars result result
62 json_get_var ubus_rpc_session ubus_rpc_session
63 echo $ubus_rpc_session
66 wg_rpcd_get_usage
() {
72 json_add_string
"jsonrpc" "2.0"
74 json_add_string
"method" "call"
75 json_add_array
"params"
76 json_add_string
"" $token
77 json_add_string
"" "wginstaller"
78 json_add_string
"" "get_usage"
83 ret
=$
(query_gw
$ip "$req") 2>/dev
/null
90 json_get_vars result result
93 json_get_var num_interfaces num_interfaces
94 echo "num_interfaces: ${num_interfaces}"
105 json_add_string
"jsonrpc" "2.0"
106 json_add_int
"id" "1"
107 json_add_string
"method" "call"
108 json_add_array
"params"
109 json_add_string
"" $token
110 json_add_string
"" "wginstaller"
111 json_add_string
"" "register"
113 json_add_int
"uplink_bw" $uplink_bw
114 json_add_int
"mtu" $mtu
115 json_add_string
"public_key" $public_key
119 ret
=$
(query_gw
$ip "$req") 2>/dev
/null
125 json_get_vars result result
128 json_get_var pubkey pubkey
129 json_get_var gw_ip gw_ip
130 json_get_var port port
131 echo "pubkey: ${pubkey}"
132 echo "gw_ip: ${gw_ip}"