Browse Source

fix: Merge remote-tracking branch 'upstream/main'

pull/102/head
Moroka8 2 months ago
parent
commit
8f03b2def3
  1. 2
      README.md
  2. 12
      client/main.go

2
README.md

@ -20,6 +20,8 @@
- https://github.com/WINGS-N/WINGSV - клиент для андроида с One UI, WireGuard, раздачей VPN с root
- https://github.com/kiper292/wireguard-turn-android - клиент для андроида интегрированный в WireGuard
- https://github.com/oxsidee/vkpn - клиент для андроида (кроссплатформенный Flutter)
- https://github.com/antongospod/turn-proxy-android - клиент для андроида c Material 3 UI и автоапдейтами (Kotlin)
- https://github.com/amurcanov/proxy-turn-vk-android - клиент для андроида с WireGuard
#### iOS
- https://github.com/nullcstring/turnbridge - клиент для iOS

12
client/main.go

@ -67,6 +67,7 @@ var (
globalAppCancel context.CancelFunc
handshakeSem = make(chan struct{}, 3)
isDebug bool
manualCaptcha bool
)
type UDPPacket struct {
@ -864,7 +865,10 @@ func getTokenChain(ctx context.Context, link string, streamID int, creds VKCrede
urlAddr := fmt.Sprintf("https://api.vk.ru/method/calls.getAnonymousToken?v=5.275&client_id=%s", creds.ClientID)
var token2 string
const maxAutoAttempts = 2
maxAutoAttempts := 2
if manualCaptcha {
maxAutoAttempts = 0
}
for attempt := 0; attempt <= maxAutoAttempts+1; attempt++ {
resp, err = doRequest(data, urlAddr)
if err != nil {
@ -940,11 +944,11 @@ func getTokenChain(ctx context.Context, link string, streamID int, creds VKCrede
}
continue
} else if attempt == maxAutoAttempts-1 {
log.Printf("[STREAM %d] [Captcha] Backing off for 30 seconds before manual fallback...", streamID)
log.Printf("[STREAM %d] [Captcha] Backing off for 2 seconds before manual fallback...", streamID)
select {
case <-ctx.Done():
return "", "", "", ctx.Err()
case <-time.After(30 * time.Second):
case <-time.After(2 * time.Second):
}
continue
}
@ -1759,6 +1763,7 @@ func main() {
direct := flag.Bool("no-dtls", false, "connect without obfuscation. DO NOT USE")
vlessMode := flag.Bool("vless", false, "VLESS mode: forward TCP connections (for VLESS) instead of UDP packets")
debugFlag := flag.Bool("debug", false, "enable debug logging")
manualCaptchaFlag := flag.Bool("manual-captcha", false, "skip auto captcha solving, use manual mode immediately")
flag.Parse()
if *peerAddr == "" {
log.Panicf("Need peer address!")
@ -1772,6 +1777,7 @@ func main() {
}
isDebug = *debugFlag
manualCaptcha = *manualCaptchaFlag
var link string
var getCreds getCredsFunc

Loading…
Cancel
Save