{"id":27972685,"url":"https://github.com/its0x4d/v2client","last_synced_at":"2025-05-07T23:13:37.769Z","repository":{"id":62733592,"uuid":"560872097","full_name":"its0x4d/v2client","owner":"its0x4d","description":"V2Client - A V2Ray/V2Fly client for python","archived":false,"fork":false,"pushed_at":"2023-03-19T07:16:58.000Z","size":145,"stargazers_count":41,"open_issues_count":3,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T23:13:32.549Z","etag":null,"topics":["library","python","v2fly","v2ray"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/its0x4d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-02T13:06:46.000Z","updated_at":"2025-04-10T00:12:30.000Z","dependencies_parsed_at":"2023-01-21T06:18:24.045Z","dependency_job_id":null,"html_url":"https://github.com/its0x4d/v2client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/its0x4d%2Fv2client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/its0x4d%2Fv2client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/its0x4d%2Fv2client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/its0x4d%2Fv2client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/its0x4d","download_url":"https://codeload.github.com/its0x4d/v2client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252968121,"owners_count":21833252,"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":["library","python","v2fly","v2ray"],"created_at":"2025-05-07T23:13:37.226Z","updated_at":"2025-05-07T23:13:37.764Z","avatar_url":"https://github.com/its0x4d.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# V2Client - A V2Ray server management for python\n\n## Installation\n\n```bash\npip install v2client\n```\n\n## How Activate gRPC API?\n\n```json lines\n// Add The following json to your config.json file \n{\n  \"stats\": {},\n  \"api\": {\n    \"tag\": \"api\",\n    \"services\": [\n      \"StatsService\", // For stats\n      \"HandlerService\", // For User and Inbound management\n      \"LoggerService\" // For log management\n    ]\n  },\n  \"policy\": {\n    \"levels\": {\n      \"0\": {\n        \"statsUserUplink\": true, // User uplink stats\n        \"statsUserDownlink\": true // User downlink stats\n      }\n    },\n    \"system\": {\n      \"statsInboundUplink\": true,\n      \"statsInboundDownlink\": true,\n      \"statsOutboundUplink\": true,\n      \"statsOutboundDownlink\": true\n    }\n  }, \n    // and then add the following inbound\n  \"inbounds\": [\n      // ... (other inbounds)\n      { \n        \"listen\": \"0.0.0.0\",\n        \"port\": 8080, // or any other port you want\n        \"protocol\": \"dokodemo-door\",\n        \"settings\": {\n          \"address\": \"0.0.0.0\"\n        },\n        \"tag\": \"api\"\n      }\n  ],\n// and then add the following routing rule\n  \"routing\": {\n    \"rules\": [\n      // ... (other rules)\n      {\n        \"inboundTag\": [\n          \"api\"\n        ],\n        \"outboundTag\": \"api\",\n        \"type\": \"field\"\n      }\n    ],\n    \"domainStrategy\": \"AsIs\"\n  }\n}\n```\n\n## Usage\n\n```python\nfrom v2client import utils\nfrom v2client import V2RayClient\nfrom v2client import enum as v2types\n\nclient = V2RayClient(\"SERVER_IP_ADDRESS\", 8080)\nusage = client.get_user_usage(\"email@gmail.com\")\nprint(f\"Download Usage: {usage.download} \u0026 Upload Usage: {usage.upload} (in bytes)\")\n\n# ADD VLESS USER\nclient.add_user(\n    inbound_tag=\"inbound_tag\",\n    proxy_type=v2types.ProxyTypes.VLESS,\n    email=\"email@gmail.com\",\n    level=0,\n    flow=v2types.VLESSFlowTypes.XTLS_RPRX_ORIGIN,  # Only for VLESS\n    encryption=v2types.VLESSEncryptionTypes.NONE,  # Only for VLESS\n    user_id=utils.random_uuid()\n)\n\n# ADD VMESS USER\nclient.add_user(\n    inbound_tag=\"inbound_tag\",\n    proxy_type=v2types.ProxyTypes.VMESS,\n    email=\"email@email.com\",\n    level=0,\n    security=v2types.VMessSecurityTypes.AES128_GCM,  # Only for VMESS\n    user_id=utils.random_uuid()\n)\n\n# Remove User\nclient.remove_user(inbound_tag=\"inbound\", email=\"email@gmail.com\")\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fits0x4d%2Fv2client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fits0x4d%2Fv2client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fits0x4d%2Fv2client/lists"}