GithubHelp home page GithubHelp logo

v2scar's Introduction

v2scar

Sidecar For V2ray

原理介绍

该项目需要以sidecar的形式和v2ray部署在一台机器上

他通过grpc接口动态添加/删除V2ray的Vmess用户,并统计流量

通过接入django-sspanel的api,可以动态调节v2ray的Vmess用户

目前实现了以下几个接口:

  • AddInboundUser
  • RemoveInboundUser
  • GetAndResetUserTraffic

使用说明

  • 可以直接以cli的形式运行:

./v2scar --api-endpoint="xxx" --grpc-endpoint="127.0.0.1:8080" --sync-time=60

  • 或者通过配置环境变量来运行:
export V2SCAR_SYNC_TIME=60 # 和django-sspanel同步的时间间隔
export V2SCAR_API_ENDPOINT="xxxx" # 这个是django-sspanel的sync api 地址
export V2SCAR_GRPC_ENDPOINT="127.0.0.1:8080" # 这个是机器上v2ray开放的grpc地址

配置V2ray:

这只是一份参考的配置, 关键的部分在于stats/api/policy/routing 另外如果需要对接 django-sspanel的话,配置里的inbound的port/tag/level必须和面板后台里的配置相同

{
    "stats": {},
    "api": {
        "tag": "api",
        "services": [
            "HandlerService",
            "StatsService"
        ]
    },
    "log": {
        "loglevel": "warning"
    },
    "policy": {
        "levels": {
            "0": {
                "statsUserUplink": true,
                "statsUserDownlink": true
            }
        },
        "system": {
            "statsInboundUplink": true,
            "statsInboundDownlink": true
        }
    },
    "inbounds": [
        {
            "tag": "proxy",
            "port": 10086,
            "protocol": "vmess",
            "settings": {
                "clients": []
            }
        },
        {
            "listen": "127.0.0.1",
            "port": 8080,
            "protocol": "dokodemo-door",
            "settings": {
                "address": "127.0.0.1"
            },
            "tag": "api"
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {}
        }
    ],
    "routing": {
        "settings": {
            "rules": [
                {
                    "inboundTag": [
                        "api"
                    ],
                    "outboundTag": "api",
                    "type": "field"
                }
            ]
        },
        "strategy": "rules"
    }
}

v2scar's People

Contributors

ehco1996 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.