A V2ray vpn Client with a focus on config managment
Project description
P2Ray
A powerful, user-friendly command-line manager for V2Ray configurations. Parse, store, test, share, and connect to VLESS, VMess, Shadowsocks, and Trojan servers—all from a single interactive CLI.
🚀 Features
- Protocol Support: VLESS, VMess, Shadowsocks (SS), Trojan
- Parsing & Storage: Import server URIs, track metadata (added time, ping count, last latency, working count, usage times, custom IDs & remarks)
- Interactive Listing: Tabulated view with sorting, filtering, aliases, ANSI‐colored, underlined hot-keys
- Protocol-Level Tests: Ping (via
v2ray-core) and download‐speed tests through a local SOCKS5 inbound - Connection Management: Launch V2Ray subprocess, toggle Windows system proxy, reconnect automatically after tests
- Share & QR Code: Reconstruct URIs or export all URIs to
.txt; generate QR codes with clipboard copy - Archiving: Move configs between active and archive DBs, with forced ID‐conflict resolution
- Extensible CLI: Add, remove, edit, archive, unarchive, test single/all, connect, toggle proxy—all with one-letter aliases
📦 Installation
pip install P2Ray
Requires
- Python 3.10+
- v2ray-core in your
PATH - Windows 10+ for system-proxy toggling
- Optional (for speed tests):
requests[socks]
🎬 Quickstart
# Run the interactive CLI
python -m P2Ray
# — or, if you’ve added `p2ray.bat` to your PATH:
p2ray
Upon launch, you’ll see a pseudo-graphic menu:
+------------------------------------------+
| |
| P2Ray Config Manager |
| |
| 1.Connect |
| 2.Disconnect |
| 3.Toggle Sys Proxy |
| ────────────────── |
| 4.List Configs View configs |
| 5.Test All Latency test all |
| 6.Add Configs Import URIs |
| 7.Share Share URI by ID |
| 8.Share All Share All URIs |
| 9.Log Con Log connection |
| ────────────────── |
| 10.Archive Config Archive Config |
| 11.Unarchive Unrchive Config |
| 12.List Archive |
| 13.Remove Config Delete by ID |
| ────────────────── |
| 14.Test Ping |
| 15.Test Speed |
| 0. Exit |
| |
+------------------------------------------+
[h3] System Proxy: Set
Type the number or its underlined alias letter (e.g. l for List, c for Connect), then press Enter.
🔧 CLI Commands
1. Add Configs
Loop‐mode import:
6 ← Number for Add Configs
uri: vless://…#Remark
id : myserver
uri: q ← finish (quite the loop)
2. List Configs
Interactive table with commands at the bottom.
In Main Menu
4 ← Number for List Configs
or
l ← Alias letter for List Configs
In the List Menu
(list) › sort lp ← sort by Last Ping (or s lp)
(list) › reverse ← toggle order (or r)
(list) › export my.csv
(list) › share 3
(list) › remove 5
(list) › archive 7
(list) › unarchive 2
(list) › edit 4, remark, New Remark
(list) › test 3
(list) › connect 3
(list) › toggle ← toggle system proxy
(list) › q ← back to main menu
3. Share / Share All
- Share: copy URI of one config to clipboard + show QR
- Share All: export every URI to
all_uris.txt
4. Test All
Ping every stored server via v2ray-core and log results.
5. Connect / Toggle Proxy
- Connect: spawn a
v2raysubprocess with local SOCKS5 on port 1081 - Toggle Proxy: flip Windows system proxy between “Clear” and “127.0.0.1:1081”
⚙️ Configuration Storage
-
Active DB:
config_db.jsonin current working directory -
Archive DB:
archive_db.json -
Each entry stores full parsed fields + metadata:
{ "type": "vless", "address": "example.com", "port": 443, "params": { "security":["tls"], ... }, "remark": "My Server", "added": 1625078400.0, "ping_count": 3, "last_ping": 1625082000.0, "last_latency": 74.2, "working_count": 5, "working_times": [ ... ], "id": "srv1", "parsed": { /* full parse structure */ } }
📖 Examples
# Import a batch, then list & sort by speed
$ p2ray
...
| 4.List Configs View configs |
| 5.Test All Latency test all |
| 6.Add Configs Import URIs |
| 7.Share Share URI by ID |
...
> 1
uri: vless://uuid@host:port?encryption=none#FastServer
id : fast1
uri: ss://YWVzLTI1Ni1jZmI6pass@ss.example:443#SS-1
id : ss1
uri: q
> 4
[list shows two servers]
(list) › sort lp
(list) › test 1
🛠️ Advanced
-
Custom v2ray path:
app = CLIApp(db_path="mydb.json", v2ray_binary="C:\\v2ray\\v2ray.exe")
-
Force‐archive with ID collision:
mgr.move_config("srv1", arc_mgr, force=True)
-
Speed testing: Downloads 1 MiB over SOCKS5 using
requests[socks].
📂 Repository & PyPI
- GitHub: https://github.com/iparsw/P2Ray
- PyPI:
pip install P2Ray
Contributions and issues are welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file p2ray-0.0.1.2.tar.gz.
File metadata
- Download URL: p2ray-0.0.1.2.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fd3280d4e37a8fb1a44a0115983d934ced4322abc46877bd6d53687e4eb2e69
|
|
| MD5 |
9d54d91d5841d328db7e240336e725fc
|
|
| BLAKE2b-256 |
7b6226d55b7d74bc7fed104345918743e4cc86e224e689bb8ded947d7a272619
|
File details
Details for the file p2ray-0.0.1.2-py3-none-any.whl.
File metadata
- Download URL: p2ray-0.0.1.2-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8780a17b7a007ccb811d06f7d081af697c5d71837885b9a6ce34f84685d506f3
|
|
| MD5 |
e87430f3c398fd4179c99429dab16fb7
|
|
| BLAKE2b-256 |
3720184a898740f726eb2af383dd9b5ca6d77241e6381efdb57f94b4138562b6
|