This commit is contained in:
darkclip committed 2024-01-02 05:20:10 +08:00
1 parent 2ec6200388
commit be73b8b5dc
1 file changed
+17 -12
+17 -12
View File
@@ -213,7 +213,7 @@ main(){
if [ ! $INTERFACE ]; then if [ ! $INTERFACE ]; then
continue; continue;
fi; fi;
wg set $INTERFACE peer 'bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=' endpoint $ip_port; wg set $INTERFACE peer $PUB_KEY endpoint $ip_port;
sleep $wait_in_between; sleep $wait_in_between;
done done
if [ $TEST_RUN = 'true' ]; then if [ $TEST_RUN = 'true' ]; then
@@ -250,16 +250,17 @@ fi;
usage(){ usage(){
echo "Usage: $0 [OPTIONS]"; echo "Usage: $0 [OPTIONS]";
echo "Options:" echo "Options:"
echo " -4 IPv4 (default)" echo " -4 IPv4 (default)"
echo " -6 IPv6" echo " -6 IPv6"
echo " -i <INTERFACE> Interface" echo " -i <INTERFACE> Interface"
echo " -c <CONFIG> Config" echo " -c <CONFIG> Config"
echo " -a <ADDRESS> Watch address (default: $WATCH_ADD)" echo " -a <ADDRESS> Watch address (default: $WATCH_ADD)"
echo " -l <LOSS> Loss threshold (default: $LOSS_THR)" echo " -l <LOSS> Loss threshold (default: $LOSS_THR)"
echo " -p <PORT> endpoint's default port (default: $DEFAULT_PORT)" echo " -p <PORT> endpoint's default port (default: $DEFAULT_PORT)"
echo " -e <ENDPOINTS_FILE> File of endpoint's addresses" echo " -e <ENDPOINTS_FILE> File of endpoint's addresses"
echo " -t Speed test only" echo " -k <PEER_PUBLIC_KEY> Interface peer's public key (default: $PUB_KEY)"
echo " -d Dry run" echo " -t Speed test only"
echo " -d Dry run"
echo "Note: If -e is not set, generate endpoints for warp, else resolve addresses and use default port." echo "Note: If -e is not set, generate endpoints for warp, else resolve addresses and use default port."
} }
@@ -270,9 +271,10 @@ WATCH_ADD='1.1.1.1';
LOSS_THR=30; LOSS_THR=30;
DEFAULT_PORT=4500; DEFAULT_PORT=4500;
ENDPOINTS=''; ENDPOINTS='';
PUB_KEY='bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=';
TEST_RUN=false; TEST_RUN=false;
DRY_RUN=false; DRY_RUN=false;
while getopts ":h46i:c:a:l:p:e:td" opt; do while getopts ":h46i:c:a:l:p:e:k:td" opt; do
case $opt in case $opt in
h) h)
usage; usage;
@@ -301,6 +303,9 @@ while getopts ":h46i:c:a:l:p:e:td" opt; do
e) e)
ENDPOINTS=$OPTARG; ENDPOINTS=$OPTARG;
;; ;;
k)
PUB_KEY=$OPTARG;
;;
t) t)
TEST_RUN=true; TEST_RUN=true;
;; ;;