This commit is contained in:
darkclip committed 2023-09-03 05:33:29 +08:00
1 parent df5a83a945
commit 47dd388057
2 files changed
+8 -3

No files matched your search

+4 -2
View File
@@ -4,7 +4,7 @@ conf=$2;
pids=$(pgrep -afl $0);
if [ $(echo $pids|grep -o $0|wc -l) -gt 1 ]; then
exit;
fi
fi;
get_rnd(){
echo $(od -An -N2 -i /dev/random);
@@ -43,4 +43,6 @@ while [ $loss -gt 40 ]; do
loss=$(get_ping_loss $watch);
done;
endpoint=$(wg show $dev endpoints | awk '{print $2}');
pfSsh.php playback chgwgpeer $conf $(echo $endpoint|awk -F: '{print $1}') $(echo $endpoint|awk -F: '{print $2}') || true;
if [ $(pfSsh.php playback chgwgpeer $conf) != $endpoint ]; then
pfSsh.php playback chgwgpeer $conf $(echo $endpoint|awk -F: '{print $1}') $(echo $endpoint|awk -F: '{print $2}') || true;
fi;
+4 -1
View File
@@ -8,7 +8,10 @@ if (is_array($command_split)) {
}
if (!isset($args[0]) || !isset($args[1]) || !isset($args[2])) {
exit(-1);
if (isset($args[0])){
echo $config['installedpackages']['wireguard']['peers']['item'][$args[0]]['endpoint'] . ":" . $config['installedpackages']['wireguard']['peers']['item'][$args[0]]['port'];
}
exit(0);
}
echo $args[0] . " -> " . $args[1] . ":" . $args[2] . "\n";