{"id":28508884,"url":"https://github.com/nichind/v2ray2proxy","last_synced_at":"2025-10-13T06:17:31.742Z","repository":{"id":297817961,"uuid":"997781186","full_name":"nichind/v2ray2proxy","owner":"nichind","description":"🌩️ Seamlessly convert vless://, vmess://, ss:// , trojan:// to socks/http proxies in your python HTTP clients","archived":false,"fork":false,"pushed_at":"2025-06-08T14:12:55.000Z","size":67,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-08T22:06:36.298Z","etag":null,"topics":["proxy","python","python-module","socks5","vless","vmess"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/v2ray2proxy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nichind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":"https://boosty.to/nichind"}},"created_at":"2025-06-07T06:59:53.000Z","updated_at":"2025-06-08T14:12:59.000Z","dependencies_parsed_at":"2025-06-09T23:00:48.113Z","dependency_job_id":null,"html_url":"https://github.com/nichind/v2ray2proxy","commit_stats":null,"previous_names":["nichind/v2ray2proxy"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichind%2Fv2ray2proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichind%2Fv2ray2proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichind%2Fv2ray2proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichind%2Fv2ray2proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichind","download_url":"https://codeload.github.com/nichind/v2ray2proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichind%2Fv2ray2proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258970708,"owners_count":22786052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proxy","python","python-module","socks5","vless","vmess"],"created_at":"2025-06-08T22:06:29.475Z","updated_at":"2025-10-13T06:17:31.737Z","avatar_url":"https://github.com/nichind.png","language":"Python","funding_links":["https://boosty.to/nichind"],"categories":[],"sub_categories":[],"readme":"\u003e [!NOTE]\n\u003e Check out [nichind/singbox2proxy](https://github.com/nichind/singbox2proxy), a similar library with better performance and more features, supporting SingBox links (hy2://, tuic://, etc.) in addition to V2Ray links, chaining support \u0026 built-in http client.\n\n\n# v2ray2proxy\n\nA Python library to convert V2Ray configuration links (vmess://, vless://, ss://, trojan://) to usable HTTP and SOCKS5 proxies for Python HTTP clients.\n\n## Features\n\n- Convert V2Ray links to local proxy instances\n- **Automatic V2Ray core download** - no external installation needed\n- Support for all major V2Ray protocols:\n  - VMess\n  - VLESS\n  - Shadowsocks\n  - Trojan\n- Proxy pool for load balancing and failover\n- Works with both synchronous and asynchronous HTTP clients\n- Clean, Pythonic API\n\n## Installation\n\n```bash\npip install v2ray2proxy\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom v2ray2proxy import V2RayProxy\nimport requests\n\n# Create a proxy from a V2Ray link\nproxy = V2RayProxy(\"vmess://...\")\n\ntry:\n    # Use with requests\n    proxies = {\n        \"http\": proxy.http_proxy_url,\n        \"https\": proxy.http_proxy_url\n    }\n    \n    response = requests.get(\"https://api.ipify.org?format=json\", proxies=proxies)\n    print(response.json())\nfinally:\n    # Always stop the proxy when done\n    proxy.stop()\n```\n\n### Using with aiohttp (Async)\n\n```python\nimport asyncio\nimport aiohttp\nfrom v2ray2proxy import V2RayProxy\n\nasync def main():\n    # Create a proxy from a V2Ray link\n    proxy = V2RayProxy(\"vmess://...\")\n    \n    try:\n        # Use with aiohttp\n        async with aiohttp.ClientSession() as session:\n            async with session.get(\n                \"https://api.ipify.org?format=json\",\n                proxy=proxy.http_proxy_url\n            ) as response:\n                data = await response.json()\n                print(data)\n    finally:\n        # Always stop the proxy when done\n        proxy.stop()\n\nasyncio.run(main())\n```\n\n### Proxy Pool for Load Balancing\n\n```python\nfrom v2ray2proxy import V2RayPool\nimport requests\n\n# Create a pool with multiple proxies\nlinks = [\n    \"vmess://...\",\n    \"vless://...\",\n    \"trojan://...\"\n]\n\npool = V2RayPool(v2ray_links=links)\n\ntry:\n    # Get the fastest proxy from the pool\n    proxy = pool.get_fastest_proxy()\n    \n    # Use the proxy\n    proxies = {\n        \"http\": proxy.http_proxy_url,\n        \"https\": proxy.http_proxy_url\n    }\n    \n    response = requests.get(\"https://api.ipify.org?format=json\", proxies=proxies)\n    print(response.json())\n    \n    # You can also get a proxy using different strategies\n    # Round-robin\n    proxy = pool.get_proxy(strategy=\"round-robin\")\n    # Random\n    proxy = pool.get_proxy(strategy=\"random\")\n    \n    # Get proxy URLs directly from the pool\n    http_url = pool.http_proxy_url()\n    socks5_url = pool.socks5_proxy_url()\nfinally:\n    # Always stop the pool when done\n    pool.stop()\n```\n\n### Command Line Usage\n\n```bash\n# Start a proxy and print the details\npython -m v2ray2proxy \"vmess://...\"\n\n# Test the proxy after starting\npython -m v2ray2proxy \"vmess://...\" --test\n\n# Specify custom ports\npython -m v2ray2proxy \"vmess://...\" --http-port 8080 --socks-port 1080\n\n# Start a proxy pool with multiple instances of the same link\npython -m v2ray2proxy \"vmess://...\" --pool --pool-size 3\n```\n\n## Supported Link Types\n\n- **VMess**: `vmess://...` - V2Ray's VMess protocol\n- **VLESS**: `vless://...` - V2Ray's VLESS protocol\n- **Shadowsocks**: `ss://...` - Shadowsocks protocol\n- **Trojan**: `trojan://...` - Trojan protocol\n\n## Advanced Usage\n\n### Custom Ports\n\n```python\nfrom v2ray2proxy import V2RayProxy\n\n# Specify custom ports\nproxy = V2RayProxy(\n    \"vmess://...\",\n    http_port=8080,\n    socks_port=1080\n)\n```\n\n### Checking Proxy Health\n\n```python\nfrom v2ray2proxy import V2RayPool\n\npool = V2RayPool(v2ray_links=[\"vmess://...\", \"vmess://...\"])\n\n# Check health of all proxies\nhealth_status = pool.check_health()\nprint(health_status)\n\n# Automatically restart unhealthy proxies\npool.auto_failover()\n```\n\n### Configuration Only Mode\n\nIf you only want to generate the configuration without starting the proxy:\n\n```python\nfrom v2ray2proxy import V2RayProxy\nimport json\n\nproxy = V2RayProxy(\"vmess://...\", config_only=True)\n\n# Get the V2Ray configuration\nconfig = proxy.generate_config()\nprint(json.dumps(config, indent=2))\n\n# Create the config file\nconfig_path = proxy.create_config_file()\nprint(f\"Config file created at: {config_path}\")\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichind%2Fv2ray2proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichind%2Fv2ray2proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichind%2Fv2ray2proxy/lists"}