### Discord Detection: Identify Discord Executables and Directories (Pascal) Source: https://context7.com/hdrover/discord-drover/llms.txt Utility functions to determine if a given filename corresponds to a Discord executable (main, Canary, or PTB) or if a directory contains a Discord installation. These functions are crucial for correctly locating and modifying Discord client files. No external dependencies are explicitly mentioned. ```Pascal const DISCORD_FILENAME_MAIN = 'Discord.exe'; DISCORD_FILENAME_CANARY = 'DiscordCanary.exe'; DISCORD_FILENAME_PTB = 'DiscordPTB.exe'; // Check if a filename is a Discord executable function IsDiscordExecutable(filename: string): boolean; // Check if a directory contains a Discord executable function DirHasDiscordExecutable(dir: string): boolean; // Example: Scan for Discord installations var discordDir: string; begin discordDir := 'C:\Users\User\AppData\Local\Discord\app-1.0.9023\'; if DirHasDiscordExecutable(discordDir) then WriteLn('Discord found in: ', discordDir); // Check specific executable if IsDiscordExecutable('Discord.exe') then WriteLn('Main Discord client'); if IsDiscordExecutable('DiscordCanary.exe') then WriteLn('Discord Canary (alpha) client'); if IsDiscordExecutable('DiscordPTB.exe') then WriteLn('Discord PTB (beta) client'); end; ``` -------------------------------- ### Load and Save Discord Drover Configuration (Pascal) Source: https://context7.com/hdrover/discord-drover/llms.txt Provides functions `LoadOptions` and `SaveOptions` for reading from and writing to the `drover.ini` configuration file. Includes an example of loading, modifying, and saving settings. ```pascal // Load configuration from INI file function LoadOptions(filename: string): TDroverOptions; // Save configuration to INI file function SaveOptions(filename: string; opt: TDroverOptions): boolean; // Example: Load, modify, and save configuration var options: TDroverOptions; configPath: string; begin configPath := ExtractFilePath(ParamStr(0)) + 'drover.ini'; // Load existing configuration options := LoadOptions(configPath); // Modify proxy settings options.proxy := 'socks5://127.0.0.1:9050'; options.useNekoboxProxy := true; options.nekoboxProxy := 'http://127.0.0.1:2080'; // Save updated configuration if SaveOptions(configPath, options) then WriteLn('Configuration saved successfully') else WriteLn('Failed to save configuration'); end; ``` -------------------------------- ### Example drover.ini Configuration for Discord Drover Source: https://github.com/hdrover/discord-drover/blob/master/README.md This configuration snippet demonstrates how to set up proxy settings for Discord Drover. It specifies the proxy protocol and address, and optionally enables the use of a separate proxy when NekoBox is detected. ```ini [drover] ; Proxy can use http or socks5 protocols proxy = http://127.0.0.1:1080 ;use-nekobox-proxy = 1 ;nekobox-proxy = http://127.0.0.1:2080 ``` -------------------------------- ### Discord Drover Options Structure and Loading (Pascal) Source: https://context7.com/hdrover/discord-drover/llms.txt Defines the `TDroverOptions` record to hold configuration settings loaded from the INI file. Shows how to load these options and access proxy details. ```pascal type TDroverOptions = record proxy: string; // Main proxy URL (e.g., 'http://127.0.0.1:1080') useNekoboxProxy: boolean; // Enable NekoBox detection nekoboxProxy: string; // Alternative proxy when NekoBox is detected end; // Loading configuration from file var options: TDroverOptions; begin options := LoadOptions('C:\Path\To\Discord\drover.ini'); // Access configuration values WriteLn('Proxy: ', options.proxy); WriteLn('Use NekoBox: ', options.useNekoboxProxy); WriteLn('NekoBox Proxy: ', options.nekoboxProxy); end; ``` -------------------------------- ### Parse and Format Proxy URLs (Pascal) Source: https://context7.com/hdrover/discord-drover/llms.txt Implements the `TProxyValue` record for parsing and validating proxy URLs (HTTP/SOCKS5) with optional authentication. Includes methods to format the proxy for environment variables and command-line flags. ```pascal type TProxyValue = record isSpecified: boolean; // True if a valid proxy was parsed prot: string; // Protocol: 'http' or 'socks5' login: string; // Username for authentication password: string; // Password for authentication host: string; // Proxy server hostname port: integer; // Proxy server port isHttp: boolean; // True if HTTP proxy isSocks5: boolean; // True if SOCKS5 proxy isAuth: boolean; // True if authentication is required procedure ParseFromString(url: string); function FormatToHttpEnv: string; // Format for HTTP_PROXY env var function FormatToChromeProxy: string; // Format for Chrome --proxy-server flag end; // Parsing various proxy URL formats var proxy: TProxyValue; begin // Parse HTTP proxy without auth proxy.ParseFromString('http://127.0.0.1:1080'); // Result: isHttp=true, host='127.0.0.1', port=1080, isAuth=false // Parse HTTP proxy with authentication proxy.ParseFromString('http://user:pass@proxy.example.com:8080'); // Result: isHttp=true, login='user', password='pass', isAuth=true // Parse SOCKS5 proxy proxy.ParseFromString('socks5://localhost:9050'); // Result: isSocks5=true, host='localhost', port=9050 // Format for environment variable WriteLn(proxy.FormatToHttpEnv); // Output: http://user:pass@proxy.example.com:8080 // Format for Chrome/Electron --proxy-server flag WriteLn(proxy.FormatToChromeProxy); // Output: http://proxy.example.com:8080 end; ``` -------------------------------- ### TSocketManager: Track Socket State for Network Operations (Pascal) Source: https://context7.com/hdrover/discord-drover/llms.txt The TSocketManager class tracks the state of TCP and UDP sockets, including whether data has been sent and flags for proxy conversions. It helps in managing socket lifecycles and applying specific logic based on socket type and send status. Dependencies include the TSocket type and Windows socket definitions. ```Pascal type TSocketManagerItem = record sock: TSocket; // Socket handle isTcp: boolean; // True for TCP (SOCK_STREAM) isUdp: boolean; // True for UDP (SOCK_DGRAM) hasSent: boolean; // True after first send operation fakeHttpProxyFlag: boolean; // Flag for HTTP-to-SOCKS5 conversion createdAt: integer; // Timestamp for garbage collection end; TSocketManager = class procedure Add(sock: TSocket; sockType, sockProtocol: integer); function IsFirstSend(sock: TSocket; var item: TSocketManagerItem): boolean; procedure SetFakeHttpProxyFlag(sock: TSocket); function ResetFakeHttpProxyFlag(sock: TSocket): boolean; end; // Example: Socket tracking during hook execution var sockManager: TSocketManager; item: TSocketManagerItem; sock: TSocket; begin sockManager := TSocketManager.Create; try // Register a new TCP socket sockManager.Add(sock, SOCK_STREAM, IPPROTO_TCP); // Check if this is the first send on this socket if sockManager.IsFirstSend(sock, item) then begin if item.isTcp then // Apply HTTP proxy authentication header injection WriteLn('First TCP send - applying proxy modifications'); if item.isUdp then // Apply UDP manipulation for voice chat WriteLn('First UDP send - applying voice bypass'); end; finally sockManager.Free; end; end; ``` -------------------------------- ### Configure Discord Drover Proxy Settings (INI) Source: https://context7.com/hdrover/discord-drover/llms.txt Defines the proxy server and optional NekoBox detection settings for Discord Drover in the `drover.ini` file. Supports HTTP and SOCKS5 protocols, with optional username and password authentication. ```ini [drover] ; Main proxy server - supports http:// and socks5:// protocols ; Leave empty for Direct mode (UDP manipulation only, no proxy) proxy = http://127.0.0.1:1080 ; HTTP proxy with authentication ; proxy = http://username:password@127.0.0.1:1080 ; SOCKS5 proxy example ; proxy = socks5://127.0.0.1:1080 ; Optional: Enable NekoBox detection for automatic proxy switching ; When NekoBox is running, use nekobox-proxy instead of main proxy ;use-nekobox-proxy = 1 ;nekobox-proxy = http://127.0.0.1:2080 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.