Skip to content

Commit

Permalink
Update stun_bt_lucky.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Oniicyan authored Aug 7, 2024
1 parent 6dd2bf9 commit 4beefc3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions stun_bt_lucky.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OWNADDR=

OWNNAME=$(echo stun_bt_$APPADDR:$APPPORT$([ -n "$IFNAME" ] && echo @$IFNAME) | sed 's/[[:punct:]]/_/g')
STUNIFO=/tmp/$OWNNAME.info
OLDPORT=$(grep $L4PROTO $STUNIFO 2>/dev/null | awk -F ':| ' '{print$3}')
OLDPORT=$LANPORT # Lucky 使用固定本地端口
RELEASE=$(grep ^ID= /etc/os-release | awk -F '=' '{print$2}' | tr -d \")

# 判断 TCP 或 UDP 的穿透是否启用
Expand Down Expand Up @@ -118,7 +118,6 @@ done
# 若未排除,则尝试直连 UPnP
if [ $DNAT = 0 ]; then
[ -n "$OLDPORT" ] && upnpc -i -d $OLDPORT $L4PROTO
[ -n "$DISPORT" ] && upnpc -i -d $DISPORT
upnpc -i -e "STUN BT $L4PROTO $WANPORT->$LANPORT->$APPPORT" -a $APPADDR $APPPORT $LANPORT $L4PROTO | \
grep $APPADDR | grep $APPPORT | grep $LANPORT | grep -v failed
[ $? = 0 ] && DNAT=3
Expand All @@ -130,7 +129,6 @@ if [ $DNAT = 0 ]; then
echo [ProxyList] >$PROXYCONF
echo http $APPADDR 3128 >>$PROXYCONF
[ -n "$OLDPORT" ] && proxychains -f $PROXYCONF upnpc -i -d $OLDPORT $L4PROTO
[ -n "$DISPORT" ] && proxychains -f $PROXYCONF upnpc -i -d $DISPORT
proxychains -f $PROXYCONF \
upnpc -i -e "STUN BT $L4PROTO $WANPORT->$LANPORT->$APPPORT" -a $APPADDR $APPPORT $LANPORT $L4PROTO | \
grep $APPADDR | grep $APPPORT | grep $LANPORT | grep -v failed
Expand Down

0 comments on commit 4beefc3

Please sign in to comment.