style: перевести комментарии на русский, убрать очевидные

This commit is contained in:
samosvalishe committed 2026-05-21 12:31:50 +03:00
1 parent ada9b949a4
commit e417dac087
48 files changed
+659 -671

No files matched your search

+8 -8
View File
@@ -12,9 +12,9 @@ import (
"github.com/bogdanfinn/tls-client/profiles"
)
// getTokenChain walks the 4-step VK token exchange for one client_id/secret
// pair and returns the resulting TURN allocate triple. Captcha errors trigger
// the configured auto/manual solver chain.
// getTokenChain выполняет 4-шаговый обмен токенами VK для одной пары client_id/secret
// и возвращает тройку TURN-allocate. Ошибки captcha запускают настроенную цепочку
// auto/manual solver.
func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, creds VKCredentials, jar tlsclient.CookieJar) (string, string, []string, error) {
profile := browserprofile.Profile{
UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36",
@@ -38,7 +38,7 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c
c.log.Infof("[STREAM %d] [VK Auth] Connecting Identity - Name: %s | User-Agent: %s", streamID, name, profile.UserAgent)
// Step 1: anonymous app token.
// Шаг 1: анонимный app-токен.
token1, err := c.fetchAnonToken(ctx, httpClient, profile, creds)
if err != nil {
return "", "", nil, err
@@ -46,7 +46,7 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c
vkDelayRandom(100, 150)
// Step 1a: getCallPreview warmup (non-fatal).
// Шаг 1a: прогрев getCallPreview (не критично).
previewData := fmt.Sprintf("vk_join_link=https://vk.com/call/join/%s&fields=photo_200&access_token=%s", link, token1)
if _, prevErr := c.doRequest(ctx, httpClient, profile, previewData,
"https://api.vk.ru/method/calls.getCallPreview?v=5.275&client_id="+creds.ClientID); prevErr != nil {
@@ -55,7 +55,7 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c
vkDelayRandom(200, 400)
// Step 2: anonymous call token (captcha may trigger here).
// Шаг 2: анонимный call-токен (здесь может сработать captcha).
token2, err := c.fetchCallToken(ctx, httpClient, profile, streamID, link, escapedName, token1, creds)
if err != nil {
return "", "", nil, err
@@ -63,7 +63,7 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c
vkDelayRandom(100, 150)
// Step 3: ok.ru session_key.
// Шаг 3: ok.ru session_key.
sessionKey, err := c.fetchOkRuSession(ctx, httpClient, profile)
if err != nil {
return "", "", nil, err
@@ -71,6 +71,6 @@ func (c *Client) getTokenChain(ctx context.Context, link string, streamID int, c
vkDelayRandom(100, 150)
// Step 4: TURN credentials.
// Шаг 4: TURN-реквизиты.
return c.fetchTurnCreds(ctx, httpClient, profile, streamID, link, token2, sessionKey)
}