Configuring Proxies
Relevant source files
The following files were used as context for generating this wiki page:
GeekezBrowser provides a robust, two-tiered proxy system powered by Xray-core. Each browser profile is configured with a primary proxy (the "target node"). Additionally, an optional "Pre-Proxy" (or "Chain Proxy") can be enabled to route traffic through an intermediary node before it reaches the primary proxy. This architecture enhances privacy by hiding the user's real IP from the primary proxy provider.
The system supports a wide range of protocols, including VMess, VLESS, Trojan, Shadowsocks, SOCKS5, and HTTP, by parsing standard proxy links. Configuration is managed through a graphical interface for both profile-specific proxies and the global Pre-Proxy settings. All settings are stored in JSON files within the user's data directory.
Sources: README.md, main.js:410-425, utils.js:239-272
Proxy Architecture
The proxy architecture in GeekezBrowser is designed for flexibility and security. When a profile is launched, the application generates a dynamic Xray-core configuration that establishes a local SOCKS5 server. The browser instance is then launched with arguments to route all its traffic through this local server. Xray-core handles the subsequent routing to the configured remote proxies.
The diagram below illustrates the data flow when both a primary and a pre-proxy are active.
This diagram shows the traffic flow from the browser through the local Xray instance, which chains the pre-proxy and main proxy before reaching the target website.
Sources: main.js:410-425, 526-530, utils.js:239-272
Profile-Specific Proxy
Each browser profile must be configured with a primary proxy link. This is the final exit node that the target website will see.
Configuration
- Creation: When a new profile is created via the "New Profile" modal, a proxy link must be provided in the
addProxytextarea. - Editing: An existing profile's proxy can be changed in the "Edit" modal's
editProxytextarea. - Storage: The proxy link is stored as the
proxyStrproperty within the profile's object inprofiles.json.
The application uses the parseProxyLink function to convert the proxy URL string into a valid Xray-core outbound configuration object. This function supports various protocols by detecting the URL scheme (e.g., vmess://, vless://, ss://).
Sources: renderer.js:609-623, 670-673, main.js:261-269, utils.js:33-237, index.html:1033-1037, 1063-1064
Supported Protocols
The parseProxyLink function in utils.js is responsible for parsing various proxy formats.
| Protocol | Scheme | Parsing Logic Location |
|---|---|---|
| VMess | vmess:// | utils.js:40-70 |
| VLESS | vless:// | utils.js:71-120 |
| Trojan | trojan:// | utils.js:121-135 |
| Shadowsocks | ss:// | utils.js:136-218 |
| SOCKS | socks5:// | utils.js:219-223 |
| HTTP | http:// | utils.js:224-228 |
Sources: utils.js:33-237, README.md
Pre-Proxy (Chain Proxy) System
The Pre-Proxy system is a global feature that can be enabled to route all profile traffic through an additional proxy layer. This is managed via the "Manage Chain" modal.
Global and Per-Profile Control
- Global Toggle: A main checkbox,
enablePreProxy, in the main toolbar controls the feature for all profiles that are set to "default". - Per-Profile Override: Each profile has a
preProxyOverridesetting, which can bedefault,on, oroff. This allows for fine-grained control, forcing the pre-proxy on or off for specific profiles, regardless of the global setting. This is managed via the quick-switch dropdown in the profile list.
The sequence diagram below shows how the application determines whether to use a pre-proxy when a profile is launched.
Pre-Proxy Management UI
The "Manage Chain" modal (proxyModal) is the central hub for configuring pre-proxies.
- Proxy Groups & Subscriptions: Proxies are organized into groups. A default
manualgroup exists for manually added proxies. Additional groups are created from remote subscription URLs. Users can add, edit, and delete subscriptions, which can be set to auto-update at specified intervals. - Node List: The main view lists all proxy nodes for the currently selected group. Each node shows its protocol, remark, and latency (if tested).
- Operating Modes: A dropdown menu allows selection of the routing mode for the pre-proxy pool.
Pre-Proxy Operating Modes
The system supports three distinct operating modes for the pool of active pre-proxies.
| Mode | ID | Description |
|---|---|---|
| Single Node | single | Manually select one specific proxy node from the list. All traffic will use this selected node. |
| Load Balance | balance | Randomly selects a proxy from the list of enabled nodes for each new profile launch. |
| Failover | failover | Uses the first enabled proxy in the list. (The implementation suggests it always picks the first, implying a simple primary/backup setup rather than true failover). |
Sources: renderer.js:740-742, 1008-1014, index.html:1095-1099
Data Storage
Pre-proxy configurations are stored in settings.json. The structure is managed by the globalSettings object in the renderer process.
This ER diagram shows the relationship between global settings, subscriptions, and the list of pre-proxy nodes.
Sources: renderer.js:231-232, 856-865, 893-900
Xray-core Integration
The bridge between the application's UI and the browser's network stack is Xray-core.
Configuration Generation
The generateXrayConfig function in utils.js is the core of the integration. It dynamically creates a JSON configuration file for Xray-core upon every profile launch.
- It parses the main profile's proxy string (
mainProxyStr) into an outbound object taggedproxy_main. - If a pre-proxy is selected, it parses that proxy's URL into an outbound object tagged
proxy_pre. - It then sets the
proxySettingsof theproxy_mainoutbound to point to theproxy_pretag, effectively creating the proxy chain. - It defines a SOCKS inbound on a free local port.
- Finally, it creates a routing rule to direct all traffic through the
proxy_mainoutbound.
Sources: utils.js:239-272, main.js:499-502
Process Management
The launch-profile handler in main.js orchestrates the entire startup sequence:
- Determines the final proxy configuration (main and pre-proxy).
- Calls
generateXrayConfigand writes the output to a profile-specificconfig.json. - Spawns an
xray.exeprocess, pointing it to the newconfig.json. - Launches a Puppeteer browser instance with the
--proxy-serverargument pointing to the local SOCKS port created by Xray. - Tracks the Xray and browser processes in the
activeProcessesobject. When the browser is closed, it forcefully terminates the associated Xray process to free up resources.
Sources: main.js:393-575
Conclusion
GeekezBrowser's proxy configuration system is a central feature that provides both robust isolation for multi-account management and enhanced privacy through its optional chaining capability. By leveraging Xray-core, it supports a wide array of modern proxy protocols and complex routing. The separation of profile-specific proxies from the global Pre-Proxy system, combined with per-profile overrides, offers a high degree of control and flexibility to the user. The entire system is managed through a clean UI that abstracts away the complexity of generating Xray-core configuration files.