|
|
|
@ -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 |
|
|
|
|