G2ray is a powerful, interactive Python curses panel designed to instantly deploy and manage Xray VLESS XHTTP configurations. Built specifically for the GitHub Codespaces environment, it automates port management, traffic monitoring, and connection keep-alives natively.
Note: The panel includes an advanced background anti-sleep engine to prevent your free-tier Codespace from hibernating while the proxy is in use.
Want to use public nodes donated by other G2ray users? Import this subscription link directly into your V2ray/Xray client:
https://raw.githubusercontent.com/Code-Leafy/G2rayXCodeLeafy/main/configs.txt
Generate and start Xray engines in seconds. The beautiful TUI (Terminal User Interface) makes managing nodes and viewing live config links effortless.
Built-in background threads prevent GitHub Codespaces from shutting down due to inactivity by constantly pinging the sub-port and simulating TTY activity, keeping your tunnel open.
Tracks real-time RX/TX data consumption and actively monitors resource usage (CPU/RAM). It accurately estimates your remaining 60-hour free-tier quota.
Donate your generated config directly from the panel to share access with the community securely, without impacting your own speed or exposing personal data.
| π οΈ Configuration Optimizer |
|---|
| To finalize your setup, take the config received from the panel and visit NetLeafy. Set the server mode to G2ray and paste your link to generate a fully optimized connection. |
Choose your platform below. For all CLI methods, the panel (g2leafy.py) is configured to auto-start immediately once you SSH into the Codespace!
No local installation required.
- Fork the Repository: Click Fork at the top-right of this GitHub page.
- Create a Codespace: Open your fork β Click the green Code button β Codespaces tab β Create codespace on main.
- Wait for Environment: Allow 1-2 minutes for the container to build.
- Launch Panel: The
g2leafy.pypanel will automatically launch in the integrated VS Code terminal!
- Install GitHub CLI: Open Terminal and run:
winget install --id GitHub.cli - Login:
gh auth login
- Fork the Repo:
gh repo fork Code-Leafy/G2rayXCodeLeafy --clone=false
- Create & Connect:
gh codespace create -R <your-username>/G2rayXCodeLeafy gh codespace ssh
- Install GitHub CLI:
# Debian/Ubuntu curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null sudo apt update && sudo apt install gh -y
- Login:
gh auth login
- Fork the Repo:
gh repo fork Code-Leafy/G2rayXCodeLeafy --clone=false
- Create & Connect:
gh codespace create -R <your-username>/G2rayXCodeLeafy gh codespace ssh
- Install GitHub CLI: Open Terminal and run:
brew install gh
- Login:
gh auth login
- Fork the Repo:
gh repo fork Code-Leafy/G2rayXCodeLeafy --clone=false
- Create & Connect:
gh codespace create -R <your-username>/G2rayXCodeLeafy gh codespace ssh
- Update & Install Packages: Open Termux and run:
pkg update -y && pkg install gh openssh -y - Login:
gh auth login
- Fork the Repo:
gh repo fork Code-Leafy/G2rayXCodeLeafy --clone=false
- Create & Connect:
gh codespace create -R <your-username>/G2rayXCodeLeafy gh codespace ssh
When launched, the panel provides a sleek graphical terminal UI (TUI).
- Use your keyboard's Arrow Keys (β/β) or Tab to navigate between tabs (Dashboard, Settings, Config Gen, Logs).
- Follow the on-screen key hints at the bottom left (e.g., press
[s]to start the engine,[x]to stop,[a]to add configs).
# If the panel does not show up automatically for any reason, run:
python3 g2leafy.pygraph LR
A[GitHub Codespace] -->|Executes| B[G2Leafy Python Panel]
B -->|Configures| C[Xray-core]
C -->|Binds Port 443| D[Codespace App Domain]
D -->|VLESS over xHTTP| E[End User Client]
π Project Structure
G2rayXCodeLeafy/
βββ data/ # Dynamic storage for usage stats, UUIDs, & configs
βββ logs/ # Xray engine error logs
βββ assets/ # Media resources (previews & videos)
βββ configs.txt # Community donated subscription configs
βββ g2leafy.py # The main interactive Python curses engine
β FAQ & Troubleshooting
My Codespace keeps shutting down?
Ensure you have activated Wake Lock (Press 3 in the Settings tab of the panel) to spawn a background keep-alive pulse that simulates activity.
Why are my speeds slow?
For optimal routing, always try to ensure your GitHub Codespace region is set to Europe West in your GitHub account settings, as this places the server in NL/DE.
β οΈ Educational Purpose Only: This project is provided for educational and research purposes. Users are solely responsible for compliance with all local laws. The developer assumes no liability for misuse.
MIT License Β· Crafted by Code-Leafy
