# cat /usr/local/etc/v2ray/config.json
{
"stats": {},
"log": {
"loglevel": "info",
"access": "/data/logs/v2ray/access.log",
"error": "/data/logs/v2ray/error.log"
},
"api": {
"tag": "api",
"services": [
"HandlerService",
"LoggerService",
"StatsService"
]
},
"policy": {
"levels": {
"0": {
"statsUserUplink": true,
"statsUserDownlink": true
},
"1": {
"statsUserUplink": true,
"statsUserDownlink": true
}
},
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true
}
},
"inbounds": [
{
"tag": "v1st",
"port": 12345,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"email": "xxx@qq.com",
"id": "6e0d2296-8864-4d1c-bc40-030c0bdd9e9d",
"level": 1,
"alterId": 64
},
{
"email": "yyy@qq.com",
"id": "0a44d0ca-782d-4836-8c92-4a9bada54376",
"level": 1,
"alterId": 64
}
]
},
"streamSettings":{
"network":"ws",
"wsSettings":{
"path":"/ws"
}
}
},
{
"tag": "v2st",
"port": 1122,
"listen":"127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"email": "zzz@qq.com",
"id": "8d09e775-3f49-4aab-b069-02bd015b0162",
"level": 1,
"alterId": 64
}
]
},
"streamSettings":{
"network":"ws",
"wsSettings":{
"path":"/ws001" //对应上nginx上的配置
}
}
},
{
"listen": "127.0.0.1",
"port": 8899,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"settings": {
"rules": [
{
"inboundTag": [
"api"
],
"outboundTag": "api",
"type": "field"
}
]
},
"strategy": "rules"
}
}
# systemctl resstart v2ray ##重启v2ray
# cat /usr/local/etc/v2ray/config.json ##查看v2ray配置
# cat /proc/sys/kernel/random/uuid ##用户uuid生成
# v2ctl api --server=127.0.0.1:8899 StatsService.GetStats 'name: "user>>>xxx@qq.com>>>traffic>>>downlink" reset: false' ##查看用户下载流量
# v2ctl api --server=127.0.0.1:8899 StatsService.GetStats 'name: "user>>>xxx@qq.com>>>traffic>>>uplink" reset: false' ##查看用户上传流量
# v2ctl api --server=127.0.0.1:8899 StatsService.QueryStats 'pattern: "" reset: false' ##查看全部用户上传下载流量,默认fasle不清除记录 true是清除记录