mirror of
https://github.com/darkclip/netlist.git
synced 2026-12-06 03:38:50 +08:00
update
This commit is contained in:
1 parent
c775e0cc5d
commit
d1e8919c3b
1 file changed
+11
-11
+11
-11
@@ -173,15 +173,15 @@ resolve_ip_addresses(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
get_json_value(){
|
get_json_value(){
|
||||||
json=$1;
|
json=$1;
|
||||||
key=$2;
|
key=$2;
|
||||||
if [ -z "$3" ]; then
|
if [ -z "$3" ]; then
|
||||||
num=1;
|
num=1;
|
||||||
else
|
else
|
||||||
num=$3;
|
num=$3;
|
||||||
fi
|
fi;
|
||||||
value=$(echo "$json" | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$key'\042/){print $(i+1)}}}' | tr -d '"' | sed -n $(echo $num)p);
|
value=$(echo "$json" | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$key'\042/){print $(i+1)}}}' | tr -d '"' | sed -n $(echo $num)p);
|
||||||
echo $value;
|
echo $value;
|
||||||
};
|
};
|
||||||
|
|
||||||
main(){
|
main(){
|
||||||
@@ -256,8 +256,8 @@ main(){
|
|||||||
*)
|
*)
|
||||||
if [ $HOST ]; then
|
if [ $HOST ]; then
|
||||||
json=$(curl -ksSf "https://$HOST/api/wireguard/client/getClient/$UUID" -H "Authorization: Basic $BASIC") 2>&1;
|
json=$(curl -ksSf "https://$HOST/api/wireguard/client/getClient/$UUID" -H "Authorization: Basic $BASIC") 2>&1;
|
||||||
s_add=$(get_json_value $json serveraddress)
|
s_add=$(get_json_value "$json" serveraddress)
|
||||||
s_port=$(get_json_value $json serverport)
|
s_port=$(get_json_value "$json" serverport)
|
||||||
if [ "$s_add:$s_port" != $endpoint ]; then
|
if [ "$s_add:$s_port" != $endpoint ]; then
|
||||||
echo "set opnSense config"
|
echo "set opnSense config"
|
||||||
curl -ksSfX POST "https://$HOST/api/wireguard/client/setClient/$UUID" \
|
curl -ksSfX POST "https://$HOST/api/wireguard/client/setClient/$UUID" \
|
||||||
|
|||||||
Reference in new issue
Block a user