### Example Usage of solvePoW Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Example demonstrating how to use the `solvePoW` function. ```go powInput := "abc123" difficulty := 2 hash := solvePoW(powInput, difficulty) // Результат: хэш, начинающийся с 00 ``` -------------------------------- ### Run Client (Android) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Starts the client with specified parameters. ```bash ./client -listen 127.0.0.1:9000 -peer :56000 -vk-link ``` ```bash ./client -udp -turn 5.255.211.241 -peer :56000 -yandex-link -listen 127.0.0.1:9000 ``` -------------------------------- ### WireGuard Configuration Example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md An example of the AllowedIPs field in a WireGuard configuration. ```text 5.227.0.0/16, 185.228.0.0/14, 185.232.0.0/13, 185.240.0.0/16, 185.241.0.0/17, 185.241.128.0/18, 185.241.196.0/22, 185.241.200.0/21, 185.241.208.0/20, 185.241.224.0/19, 185.242.0.0/15, 185.244.0.0/14, 185.248.0.0/13, 186.0.0.0/7, 188.0.0.0/10, 188.64.0.0/12, 188.80.0.0/13, 188.88.0.0/14, 188.92.0.0/16, 188.93.0.0/19, 188.93.32.0/20, 188.93.48.0/21, 188.93.64.0/18, 188.93.128.0/17, 188.94.0.0/15, 188.96.0.0/11, 188.128.0.0/9, 189.0.0.0/8, 190.0.0.0/7, 192.0.0.0/8, 193.0.0.0/9, 193.128.0.0/10, 193.192.0.0/13, 193.200.0.0/15, 193.202.0.0/16, 193.203.0.0/19, 193.203.32.0/21, 193.203.44.0/22, 193.203.48.0/20, 193.203.64.0/18, 193.203.128.0/17, 193.204.0.0/14, 193.208.0.0/12, 193.224.0.0/11, 194.0.0.0/9, 194.128.0.0/11, 194.160.0.0/12, 194.176.0.0/13, 194.184.0.0/15, 194.186.0.0/19, 194.186.32.0/20, 194.186.48.0/21, 194.186.56.0/22, 194.186.60.0/23, 194.186.62.0/24, 194.186.64.0/18, 194.186.128.0/17, 194.187.0.0/16, 194.188.0.0/14, 194.192.0.0/10, 195.0.0.0/9, 195.128.0.0/10, 195.192.0.0/12, 195.208.0.0/15, 195.210.0.0/16, 195.211.0.0/20, 195.211.16.0/22, 195.211.24.0/21, 195.211.32.0/19, 195.211.64.0/18, 195.211.128.0/17, 195.212.0.0/14, 195.216.0.0/15, 195.218.0.0/17, 195.218.128.0/19, 195.218.160.0/20, 195.218.176.0/21, 195.218.184.0/22, 195.218.188.0/23, 195.218.192.0/18, 195.219.0.0/16, 195.220.0.0/14, 195.224.0.0/11, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/6, 212.0.0.0/10, 212.64.0.0/11, 212.96.0.0/13, 212.104.0.0/14, 212.108.0.0/15, 212.110.0.0/16, 212.111.0.0/18, 212.111.64.0/20, 212.111.80.0/22, 212.111.88.0/21, 212.111.96.0/19, 212.111.128.0/17, 212.112.0.0/12, 212.128.0.0/10, 212.192.0.0/11, 212.224.0.0/13, 212.232.0.0/16, 212.233.0.0/18, 212.233.64.0/21, 212.233.80.0/21, 212.233.100.0/22, 212.233.104.0/21, 212.233.112.0/21, 212.233.124.0/22, 212.233.128.0/17, 212.234.0.0/15, 212.236.0.0/14, 212.240.0.0/12, 213.0.0.0/9, 213.128.0.0/10, 213.192.0.0/12, 213.208.0.0/13, 213.216.0.0/15, 213.218.0.0/16, 213.219.0.0/17, 213.219.128.0/18, 213.219.192.0/20, 213.219.208.0/22, 213.219.216.0/21, 213.219.224.0/19, 213.220.0.0/14, 213.224.0.0/11, 214.0.0.0/7, 216.0.0.0/8, 217.0.0.0/12, 217.16.0.0/20, 217.16.32.0/19, 217.16.64.0/18, 217.16.128.0/17, 217.17.0.0/16, 217.18.0.0/15, 217.20.0.0/17, 217.20.128.0/20, 217.20.160.0/19, 217.20.192.0/18, 217.21.0.0/16, 217.22.0.0/15, 217.24.0.0/13, 217.32.0.0/11, 217.64.0.0/14, 217.68.0.0/16, 217.69.0.0/17, 217.69.144.0/20, 217.69.160.0/19, 217.69.192.0/18, 217.70.0.0/15, 217.72.0.0/13, 217.80.0.0/12, 217.96.0.0/11, 217.128.0.0/11, 217.160.0.0/13, 217.168.0.0/14, 217.172.0.0/15, 217.174.0.0/17, 217.174.128.0/19, 217.174.160.0/20, 217.174.176.0/21, 217.174.184.0/22, 217.174.192.0/18, 217.175.0.0/16, 217.176.0.0/12, 217.192.0.0/10, 218.0.0.0/7, 220.0.0.0/6, 224.0.0.0/3 ``` -------------------------------- ### Run Client (iOS/iSH) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Starts the client within the iSH Shell. ```bash ./client -listen 127.0.0.1:9000 -peer :56000 -vk-link ``` -------------------------------- ### Example usage of getRandomProfile Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Example of how to use the getRandomProfile function to set request headers. ```go randomProfile := getRandomProfile() req.Header.Set("User-Agent", randomProfile.UserAgent) req.Header.Set("sec-ch-ua", randomProfile.SecChUa) ``` -------------------------------- ### Run Server Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Starts the server, listening on a specified address and connecting to a WireGuard port. ```bash # Запуск сервера ./server -listen 0.0.0.0:56000 -connect 127.0.0.1:<порт wg> ``` -------------------------------- ### Install curl (iSH Shell) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Installs curl if it's not already present in the iSH Shell. ```bash apk update apk add curl ``` -------------------------------- ### Server usage example for NewKCPOverDTLS Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Пример использования NewKCPOverDTLS для сервера. ```go dtlsConn, _ := listener.Accept() kcpSess, _ := NewKCPOverDTLS(dtlsConn, true) def kcpSess.Close() smuxSess, _ := smux.Server(kcpSess, DefaultSmuxConfig()) for { stream, _ := smuxSess.AcceptStream() // Обработка stream } ``` -------------------------------- ### V2Ray Client Configuration Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Example V2Ray client configuration. ```json { "inbounds": [ { "protocol": "socks", "listen": "127.0.0.1", "port": 1080, "settings": { "udp": true }, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } }, { "protocol": "http", "listen": "127.0.0.1", "port": 8080, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } } ], "outbounds": [ { "protocol": "wireguard", "settings": { "secretKey": "", "peers": [ { "endpoint": "127.0.0.1:9000", "publicKey": "" } ], "domainStrategy": "ForceIPv4", "mtu": 1280 } } ] } ``` -------------------------------- ### Example Usage of DefaultSmuxConfig Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Demonstrates how to use the DefaultSmuxConfig to create a smux client session. ```go cfg := DefaultSmuxConfig() smuxSession, err := smux.Client(kcpConn, cfg) ``` -------------------------------- ### Interpreting logs: Successful server startup Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Example log output for a successful server startup, showing listening status, connection details, and KCP/smux session establishment. ```text Listening Connection from : Start handshake Handshake done KCP session established (server) smux session established (server) ``` -------------------------------- ### Client usage example for NewKCPOverDTLS Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Пример использования NewKCPOverDTLS для клиента. ```go dtlsConn, _ := dtls.ClientWithOptions(...) kcpSess, _ := NewKCPOverDTLS(dtlsConn, false) def kcpSess.Close() // Используем как обычный net.Conn smuxSess, _ := smux.Client(kcpSess, DefaultSmuxConfig()) ``` -------------------------------- ### V2Ray Server Configuration Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Example V2Ray server configuration. ```json { "inbounds": [ { "protocol": "wireguard", "listen": "0.0.0.0", "port": 51820, "settings": { "secretKey": "", "peers": [ { "publicKey": "" } ], "mtu": 1280 }, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } } ], "outbounds": [ { "protocol": "freedom", "settings": { "domainStrategy": "UseIPv4" } } ] } ``` -------------------------------- ### Interpreting logs: Successful client startup Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Example log output indicating a successful client startup, including VK authentication details and DTLS connection establishment. ```text [STREAM 0] [VK Auth] Connecting Identity - Name: Иван Петров [STREAM 0] [VK Auth] Trying credentials: client_id=6287487 [STREAM 0] [VK Auth] Success with client_id=6287487 [STREAM 0] [VK Auth] Using cached credentials [STREAM 0] Established DTLS connection! [STREAM 0] relayed-address=: ``` -------------------------------- ### Connected Streams Check Example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Example code showing how to check the number of connected streams to detect critical errors. ```go if connectedStreams.Load() == 0 { // Нет активных потоков - критическая ошибка, выход return "", fmt.Errorf("FATAL_CAPTCHA_FAILED_NO_STREAMS") } ``` -------------------------------- ### generateFakeCursor Example Result Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Example of the JSON output for simulated mouse coordinates. ```json [ {"x":782,"y":431,"t":1704067200000}, {"x":785,"y":433,"t":1704067218000}, {"x":788,"y":432,"t":1704067236000}, ... ] ``` -------------------------------- ### VLESS Mode (Xray) Setup Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Provides server and client commands for VLESS mode using Xray, along with an example Xray VLESS inbound configuration. ```bash ./server \ -listen 0.0.0.0:56000 \ -connect 127.0.0.1:443 \ -vless ``` ```bash ./client \ -listen 127.0.0.1:9000 \ -peer 192.168.1.100:56000 \ -vk-link "https://vk.com/call/join/abc123" \ -n 5 \ -vless ``` ```json { "inbounds": [ { "protocol": "vless", "listen": "127.0.0.1", "port": 443, "settings": { "clients": [ {"id": "uuid-here", "level": 0} ], "decryption": "none" } } ], "outbounds": [ { "protocol": "freedom", "settings": {"domainStrategy": "UseIPv4"} } ] } ``` -------------------------------- ### Credential Caching Example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Example of caching obtained credentials with an expiration time. ```go cache.creds = TurnCredentials{ Username: user, Password: pass, ServerAddr: addr, ExpiresAt: time.Now().Add(credentialLifetime - cacheSafetyMargin), Link: link, } ``` -------------------------------- ### solveCaptchaViaProxy Output Example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Example of the output message displayed to the user when manual CAPTCHA solving is required. ```plaintext ============================================== ACTION REQUIRED: MANUAL CAPTCHA SOLVING NEEDED Open this URL in your browser: http://localhost:8765 ============================================== ``` -------------------------------- ### How applyBrowserProfile Works Example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Illustrates the usage of applyBrowserProfile to make a request appear as if it's from a browser. ```go req := createHTTPRequest() profile := getRandomProfile() // Случайный выбор applyBrowserProfile(req, profile) // Применить header // Результат: запрос выглядит как от браузера Chrome/Edge // вместо очевидного бота ``` -------------------------------- ### Interpreting logs: Error example Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Example log output demonstrating an error scenario, including VK authentication failure and captcha solving steps. ```text [STREAM 0] [VK Auth] Failed with client_id=6287487: error_code: 14... [STREAM 0] [Captcha] Solving captcha with auto mode... [STREAM 0] [Captcha] Step 1/4: settings [STREAM 0] [Captcha] Step 2/4: componentDone [STREAM 0] [Captcha] Step 3/4: check [STREAM 0] [Captcha] Step 4/4: endSession ``` -------------------------------- ### Basic VK (WireGuard) Setup Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Demonstrates the basic server and client commands for setting up VK with WireGuard, along with the client's WireGuard configuration. ```bash ./server -listen 0.0.0.0:56000 -connect 127.0.0.1:51820 ``` ```bash ./client \ -listen 127.0.0.1:9000 \ -peer 192.168.1.100:56000 \ -vk-link "https://vk.com/call/join/abc123" \ -n 10 ``` ```ini [Interface] Address = 10.0.0.2/32 PrivateKey = <ключ> MTU = 1280 [Peer] PublicKey = <ключ> Endpoint = 127.0.0.1:9000 AllowedIPs = 0.0.0.0/0, ::/0 ``` -------------------------------- ### Bandwidth Optimization Parameters Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Examples of command-line parameters for optimizing bandwidth usage, focusing on speed, stability, and traffic economy. ```bash # Для максимальной скорости: -n 20 # 20 потоков -udp # UDP вместо TCP (без -no-dtls) # DTLS шифрование в порядке ``` ```bash # Для стабильности (рекомендуется): -n 10 # 10 потоков -udp false # TCP более надежен ``` ```bash # Для экономии трафика: -n 1 # Минимум потоков -manual-captcha # Избежать лишних API запросов ``` -------------------------------- ### Systemd Service Management Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Commands to reload systemd, enable, and start the VK Turn Proxy service. ```bash systemctl daemon-reload systemctl enable vk-turn-proxy.service systemctl start vk-turn-proxy.service ``` -------------------------------- ### Configuring Smux for TURN Tunnel Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Example of setting up a smux configuration with specific buffer sizes and keep-alive settings for a TURN tunnel. ```go cfg := smux.DefaultConfig() cfg.MaxReceiveBuffer = 4 * 1024 * 1024 // 4 MB cfg.MaxStreamBuffer = 1 * 1024 * 1024 // 1 MB cfg.KeepAliveInterval = 10 * time.Second // keep-alive каждые 10 сек cfg.KeepAliveTimeout = 30 * time.Second // таймаут keep-alive 30 сек return cfg ``` -------------------------------- ### Client-side Smux Session Creation Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Example of creating a smux session on the client side, integrating KCP over DTLS. ```go // client/main.go createSmuxSession() kcpSess, err := tcputil.NewKCPOverDTLS(dtlsConn, false) smuxSess, err := smux.Client(kcpSess, tcputil.DefaultSmuxConfig()) stream, err := smuxSess.OpenStream() pipe(ctx, tcpConn, stream) // Пересыл TCP ↔ smux ``` -------------------------------- ### Example usage of getVkCredsCached Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Пример получения учетных данных TURN. ```go user, pass, addr, err := getVkCredsCached(ctx, "abc123", 0, dialer) if err != nil { log.Printf("Failed to get credentials: %v", err) return } ``` -------------------------------- ### runVLESSMode Function Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Starts VLESS mode: forwards TCP connections through TURN + DTLS + KCP + smux. ```go func runVLESSMode( ctx context.Context, tp *turnParams, peer *net.UDPAddr, listenAddr string, numSessions int, ) ``` -------------------------------- ### Server-side Smux Session Handling Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Example of handling smux sessions on the server side, integrating KCP over DTLS. ```go // server/main.go handleVLESSConnection() kcpSess, err := tcputil.NewKCPOverDTLS(dtlsConn, true) smuxSess, err := smux.Server(kcpSess, tcputil.DefaultSmuxConfig()) stream, err := smuxSess.AcceptStream() pipeConn(ctx, stream, backendConn) // Пересыл smux ↔ backend TCP ``` -------------------------------- ### Yandex Telemost (UDP) Setup Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Shows the server and client commands for integrating with Yandex Telemost using UDP. ```bash ./server -listen 0.0.0.0:56000 -connect 127.0.0.1:51820 ``` ```bash ./client \ -listen 127.0.0.1:9000 \ -peer 192.168.1.100:56000 \ -yandex-link "https://telemost.yandex.ru/j/xyz789" \ -turn 5.255.211.241 \ -udp \ -n 1 ``` -------------------------------- ### Command-Line Parameters for Captcha Handling Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Examples of command-line flags related to CAPTCHA solving. ```bash # Использовать только ручное решение ./client -manual-captcha ... # Автоматическое без slider POC ./client ... (по умолчанию enableSliderPOC=true) ``` -------------------------------- ### Using Profiles for VK API Requests Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Example of how to use a browser profile for VK API requests. ```go profile := getRandomProfile() req, _ := http.NewRequest("POST", "https://api.vk.ru/method/...", body) applyBrowserProfile(req, profile) client.Do(req) ``` -------------------------------- ### Download and Make Executable Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Downloads the server binary and makes it executable. ```bash # Скачать бинарник curl -L -o server https://github.com/cacggghp/vk-turn-proxy/releases/latest/download/server-linux-amd64 && chmod +x server ``` -------------------------------- ### Docker Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Run the server in a Docker container. ```bash docker run -p 56000:56000/udp -e CONNECT_ADDR=127.0.0.1:443 -e VLESS_MODE=true vk-turn-proxy ``` -------------------------------- ### Server (VPS) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Run the server with the -vless flag. ```bash ./server -listen 0.0.0.0:56000 -connect 127.0.0.1:443 -vless ``` -------------------------------- ### Client Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Run the client with the -vless flag. ```bash ./client -peer :56000 -vk-link -listen 127.0.0.1:9000 -vless ``` -------------------------------- ### For Captcha Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Example of using a profile for captcha-related operations. ```go profile := getRandomProfile() // В buildCaptchaDeviceJSON используется profile.UserAgent deviceJSON := buildCaptchaDeviceJSON(profile) // В generateBrowserFp browserFp := generateBrowserFp(profile) ``` -------------------------------- ### Download and Execute Client (Android ARM64) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Downloads the binary for the most popular architecture (client-android-arm64), gives it execute permissions. ```bash curl -L -o client https://github.com/cacggghp/vk-turn-proxy/releases/latest/download/client-android-arm64 && chmod +x client ``` -------------------------------- ### For Yandex API Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/profiles.md Example of using a profile for Yandex API requests. ```go profile := getRandomProfile() req, _ := http.NewRequest("GET", "https://cloud-api.yandex.ru/...", nil) applyBrowserProfile(req, profile) client.Do(req) ``` -------------------------------- ### Manual Docker Image Build Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Clones the repository and builds the Docker image manually. ```bash git clone https://github.com/cacggghp/vk-turn-proxy.git cd vk-turn-proxy docker build -t vk-turn-proxy . ``` -------------------------------- ### Download and Execute Client (iOS/iSH) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Downloads the binary and grants execute permissions for the client in iSH Shell. ```bash curl -L -o client https://github.com/cacggghp/vk-turn-proxy/releases/latest/download/client-linux-386 && chmod +x client ``` -------------------------------- ### macOS Client Binary Download (Apple Silicon) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Download command for the macOS client binary for Apple Silicon. ```bash curl -L -o client https://github.com/cacggghp/vk-turn-proxy/releases/latest/download/client-darwin-arm64 && chmod +x client ``` -------------------------------- ### macOS Client Binary Download (Intel) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Download command for the macOS client binary for Intel processors. ```bash curl -L -o client https://github.com/cacggghp/vk-turn-proxy/releases/latest/download/client-darwin-amd64 && chmod +x client ``` -------------------------------- ### Example usage of ParseVkCaptchaError Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Пример использования ParseVkCaptchaError для проверки ошибки капчи. ```go resp, _ := json.Unmarshal(body) errData := resp["error"].(map[string]interface{}) captchaErr := ParseVkCaptchaError(errData) if captchaErr != nil && captchaErr.IsCaptchaError() { // Необходимо решить капчу } ``` -------------------------------- ### Docker Run (Manual Build) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Runs the Docker container built manually, specifying the WireGuard connection address. ```bash docker run -p 56000:56000/udp -e CONNECT_ADDR=192.168.1.10:51820 vk-turn-proxy ``` -------------------------------- ### Global Captcha Lockout Usage Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Example code demonstrating how to check and set the global CAPTCHA lockout. ```go // Проверка перед началом if time.Now().Unix() < globalCaptchaLockout.Load() { return "", fmt.Errorf("CAPTCHA_WAIT_REQUIRED: global lockout active") } // Установка после ошибки globalCaptchaLockout.Store(time.Now().Add(60*time.Second).Unix()) ``` -------------------------------- ### Client Command-Line Parameters Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md This section lists the available command-line parameters for the client, along with their descriptions and default values. ```bash -listen string Адрес для слушания (по умолчанию "127.0.0.1:9000") -peer string Адрес WireGuard сервера (требуется) формат: host:port -vk-link string Ссылка на звонок VK: "https://vk.com/call/join/વું" -yandex-link string Ссылка на Яндекс Телемост: "https://telemost.yandex.ru/j/" -n int Количество TURN потоков (по умолчанию 10 для VK, 1 для Яндекса) -udp Использовать UDP для подключения к TURN (вместо TCP) -turn string Переопределить адрес TURN сервера -port string Переопределить порт TURN сервера -no-dtls Отправлять пакеты без DTLS (НЕ РЕКОМЕНДУЕТСЯ) -vless Режим VLESS: forward TCP соединений вместо UDP пакетов -manual-captcha Пропустить автоматическое решение капчи, использовать ручной режим -debug Включить логирование отладки ``` -------------------------------- ### Enable logging Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Commands to enable debugging and logging for both the client and server, including piping output to a file and monitoring server logs for errors. ```bash # Клиент с отладкой ./client -debug ... 2>&1 | tee client.log # Сервер с отладкой ./server ... 2>&1 | tee server.log tail -f server.log | grep -i error ``` -------------------------------- ### func fetchCaptchaBootstrap Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Получает HTML страницу капчи и парсит bootstrap параметры, необходимые для решения. ```go func fetchCaptchaBootstrap( ctx context.Context, redirectURI string, client tlsclient.HttpClient, profile Profile, ) (*captchaBootstrap, error) ``` -------------------------------- ### Recommended Parameters for Economy Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/README.md Recommended parameters for economy, using a minimum number of threads. ```bash -n 1-3 # Минимум потоков ``` -------------------------------- ### createSmuxSession Function Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Creates a full TURN+DTLS+KCP+smux stack. ```go func createSmuxSession( ctx context.Context, tp *turnParams, peer *net.UDPAddr, id int, ) (*smux.Session, func(), error) ``` -------------------------------- ### Captcha Error Handling Logic Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/captcha-solvers.md Example code illustrating the logic for handling CAPTCHA solving errors and attempting different modes. ```go // Попытка решить капчу successToken, solveErr := solveVkCaptcha(ctx, captchaErr, streamID, ...) if solveErr != nil { // Перейти на следующий режим nextMode, hasNext := captchaSolveModeForAttempt(attempt+1, manualOnly, enableSlider) if hasNext { // Попробовать следующий режим continue } else { // Попыток исчерпано globalCaptchaLockout.Store(time.Now().Add(60*time.Second).Unix()) return "", fmt.Errorf("CAPTCHA_WAIT_REQUIRED") } } ``` -------------------------------- ### Dependencies Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Lists the external Go modules required by the tcputil package. ```go import ( "github.com/xtaci/kcp-go/v5" "github.com/xtaci/smux" ) ``` -------------------------------- ### Setting MTU for KCP Session Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Code examples for adjusting the Maximum Transmission Unit (MTU) for a KCP session based on network conditions. ```go sess.SetMtu(1400) // Увеличить, если нет фрагментации sess.SetMtu(1000) // Уменьшить для высокой потери пакетов ``` -------------------------------- ### Documentation Usage Map Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/README.md A flowchart illustrating the documentation's usage map, from initial setup to advanced topics. ```text Начало использования ↓ Прочитай configuration.md ↓ Выбери режим (UDP/VLESS) ↓ Запусти сервер/клиент ↓ Проблемы? ↓ Смотри errors.md + логирование ↓ Хочешь понять как это работает? ↓ Читай api-reference/*.md ↓ Нужны типы данных? ↓ Смотри types.md ``` -------------------------------- ### Systemd Service Configuration Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Configuration for a Systemd service to manage the VK Turn Proxy, including setup and log viewing commands. ```ini [Unit] Description=VK Turn Proxy Service After=network.target Wants=network-online.target [Service] Type=simple User=vkturn WorkingDirectory=/opt/vk-turn-proxy ExecStart=/opt/vk-turn-proxy/server \ -listen 0.0.0.0:56000 \ -connect 127.0.0.1:51820 Restart=always RestartSec=10 StandardOutput=journal StandardError=journal SyslogIdentifier=vk-turn-proxy # Безопасность NoNewPrivileges=true PrivateTmp=true [Install] WantedBy=multi-user.target ``` ```bash sudo systemctl enable vk-turn-proxy sudo systemctl start vk-turn-proxy sudo journalctl -u vk-turn-proxy -f ``` -------------------------------- ### Get Yandex Credentials Function Signature Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/client.md Signature for the `getYandexCreds` function, which obtains TURN credentials for Yandex Telemost via WebSocket. ```go func getYandexCreds(link string) (string, string, string, error) ``` -------------------------------- ### Linux Client Command Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Command to run the Linux client with VK link. ```bash ./client-linux -peer :56000 -vk-link -listen 127.0.0.1:9000 | sudo routes.sh ``` -------------------------------- ### Docker Run (Host Network) Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Runs the Docker container using the host network, suitable for Linux servers with local WireGuard. ```bash docker run --rm --network host -e CONNECT_ADDR=127.0.0.1:<порт wg> vkt ``` -------------------------------- ### Recommended Parameters for Speed Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/README.md Recommended parameters for speed, emphasizing high parallelism and UDP for potential faster performance. ```bash -n 20-30 # Высокий параллелизм -udp true # UDP может быть быстрее ``` -------------------------------- ### Recommended Parameters for Stability Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/README.md Recommended parameters for stability, focusing on moderate parallelism and TCP for reliability. ```bash -n 5-10 # Средний параллелизм -udp false # TCP более надежен ``` -------------------------------- ### Критические ошибки (panic/fatalf) - Failed to listen Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Ошибка возникает, если клиент не может открыть UDP порт. Возможные причины: порт занят, недостаточно прав, неверный адрес. Требуется проверить использование порта и при необходимости использовать другой порт или запустить с sudo. ```go Триггер: Клиент не может открыть UDP порт Место: client/main.go:1876 Условие: net.ListenPacket("udp", *listen) ошибка Обработка: panic Причины: - Порт уже в использовании - Недостаточно прав (порт < 1024) - Неверный адрес Решение: - Проверить lsof -i :9000 - Использовать другой порт -listen 127.0.0.1:9001 - Запустить с sudo если требуется ``` -------------------------------- ### Windows Client Command Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Command to run the Windows client with VK link. ```powershell ./client.exe -peer :56000 -vk-link -listen 127.0.0.1:9000 | routes.ps1 ``` -------------------------------- ### Troubleshooting: 'need peer address' Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Command to resolve the 'need peer address' error by specifying the peer address. ```bash ./client -peer 192.168.1.100:56000 ... ``` -------------------------------- ### Enabling Logging - Client Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/README.md Command to enable debug logging for the client and redirect output to a file. ```bash # Клиент с отладкой ./client -debug ... 2>&1 | tee client.log ``` -------------------------------- ### Критические ошибки (panic/fatalf) - Need either vk-link or yandex-link! Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Ошибка возникает, если клиент запущен без ссылки на звонок или с обеими ссылками одновременно. Требуется указать ровно одну ссылку. ```go Триггер: Клиент запущен без ссылки на звонок Место: client/main.go:1823 Условие: (*vklink == "") == (*yalink == "") т.е. ни одна или обе одновременно Обработка: panic Решение: Указать ровно одну из ссылок ``` -------------------------------- ### Docker переменные окружения Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Переменные окружения для настройки VK Turn Proxy при использовании Docker. ```bash LISTEN_ADDR Адрес слушания для сервера Пример: 0.0.0.0:56000 Используется: server/main.go ``` ```bash CONNECT_ADDR Адрес подключения к WireGuard/Xray Пример: 127.0.0.1:51820 Используется: server/main.go ``` ```bash VLESS_MODE Включить VLESS режим Значения: "true", "false" Используется: server/main.go ``` -------------------------------- ### Linux Client Command with UDP and TURN Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Command to run the Linux client with UDP and specified TURN server. ```bash ./client-linux -udp -turn 5.255.211.241 -peer :56000 -yandex-link -listen 127.0.0.1:9000 | sudo routes.sh ``` -------------------------------- ### Tuning KCP for Fast and Stable Networks Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Configuration adjustments for KCP and smux to optimize performance on fast and stable network conditions. ```go cfg := DefaultSmuxConfig() cfg.MaxReceiveBuffer = 16 * 1024 * 1024 // 16 MB kcpSess.SetWindowSize(512, 512) // большие окна kcpSess.SetMtu(1400) // больший MTU ``` -------------------------------- ### Enable Debugging - Server Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/configuration.md Commands to enable debug logging for the server, redirect output to a file, and monitor the log. ```bash ./server ... 2>&1 | tee server.log tail -f server.log ``` -------------------------------- ### Docker Pull and Tag Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Pulls the latest Docker image and tags it for easier use. ```bash docker pull ghcr.io/cacggghp/vk-turn-proxy:latest docker tag ghcr.io/cacggghp/vk-turn-proxy:latest vkt ``` -------------------------------- ### Критические ошибки (panic/fatalf) - Need peer address! Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Ошибка возникает, если клиент запущен без флага -peer. Требуется указать адрес пира. ```go Триггер: Клиент запущен без флага -peer Место: client/main.go:1817 Условие: *peerAddr == "" Обработка: panic Решение: Добавить флаг -peer ``` -------------------------------- ### Критические ошибки (panic/fatalf) - Direct mode not supported with dispatcher Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/errors.md Ошибка возникает, если клиент запущен с флагом -no-dtls. Прямой режим не поддерживается с диспетчером. ```go Триггер: Клиент запущен с флагом -no-dtls Место: client/main.go:1934 Условие: *direct == true Обработка: panic Решение: Не использовать -no-dtls ``` -------------------------------- ### Server-side Error Handling for KCP and Smux Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/_autodocs/api-reference/tcputil.md Demonstrates error handling when establishing KCP and smux server sessions. ```go kcpSess, err := NewKCPOverDTLS(dtlsConn, true) if err != nil { log.Printf("KCP session error: %s", err) dtlsConn.Close() return } def kcpSess.Close() smuxSess, err := smux.Server(kcpSess, DefaultSmuxConfig()) if err != nil { log.Printf("smux server error: %s", err) return } def smuxSess.Close() ``` -------------------------------- ### Systemd Service File Source: https://github.com/cacggghp/vk-turn-proxy/blob/main/README.md Configuration for a systemd service to run the VK Turn Proxy automatically. ```bash [Unit] Description=VK Turn Proxy Service After=network.target [Service] Type=simple ExecStart=/opt/vk-turn-proxy/server-linux-amd64 -listen 0.0.0.0:56000 -connect 127.0.0.1: KillMode=process Restart=always RestartSec=5 User=nobody Group=nogroup StandardOutput=append:/var/log/vk-turn-proxy/vk-turn-proxy.log StandardError=append:/var/log/vk-turn-proxy/vk-turn-proxy_error.log SyslogIdentifier=vk-turn-proxy [Install] WantedBy=multi-user.target ```