File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,10 +100,25 @@ get_real_interface() {
100100}
101101
102102add_if () {
103- export WG_TUN_NAME_FILE=" /var/run/wireguard/$INTERFACE .name"
104- mkdir -p " /var/run/wireguard/"
105- cmd " ${WG_QUICK_USERSPACE_IMPLEMENTATION:- wireguard-go} " tun
106- get_real_interface
103+ local index
104+ echo " find wg" | config -e /bsd 2> /dev/null | grep " wg count 1" > /dev/null
105+ if [[ $? == 0 ]]; then
106+ REAL_INTERFACE=" "
107+ index=0
108+ while [[ $REAL_INTERFACE == " " ]]; do
109+ ifconfig wg$index create
110+ if [[ $? == 0 ]]; then
111+ $REAL_INTERFACE =" wg$index "
112+ fi
113+ index=$(( index+ 1 ))
114+ done
115+ echo " [+] Interface for $INTERFACE is $REAL_INTERFACE " >&2
116+ else
117+ export WG_TUN_NAME_FILE=" /var/run/wireguard/$INTERFACE .name"
118+ mkdir -p " /var/run/wireguard/"
119+ cmd " ${WG_QUICK_USERSPACE_IMPLEMENTATION:- wireguard-go} " tun
120+ get_real_interface
121+ fi
107122}
108123
109124del_routes () {
You can’t perform that action at this time.
0 commit comments