add statistics support

This commit is contained in:
Evgeny Nerush
2023-11-19 17:49:38 +03:00
parent e32c1042b4
commit 3be5fa51c8
4 changed files with 120 additions and 12 deletions

View File

@@ -7,8 +7,44 @@
"loglevel": "warning",
"dnsLog": false
},
// Turns on traffic statistics, see https://xtls.github.io/en/config/stats.html#statsobject
// and https://xtls.github.io/en/config/policy.html#policyobject
// and special "api" tag below
"stats": {
},
"policy": {
"levels": {
// default level
"0": {
"statsUserUplink": true,
"statsUserDownlink": true
}
},
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true,
"statsOutboundUplink": true,
"statsOutboundDownlink": true
}
},
// enables API interface https://xtls.github.io/en/config/api.html#apiobject
"api": {
"tag": "api",
"services": [ "StatsService" ]
},
// client-side inbound configuration
"inbounds": [
// gRPC API inbound, used to get statistics
{
"listen": "127.0.0.1",
"port": 8080,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
},
// socks proxy
{
"tag": "socks",
"port": 800,
@@ -22,12 +58,13 @@
"tls"
]
},
// settings of inbound `protocol` (see above)
// settings of inbound "protocol" (see above)
"settings": {
"auth": "noauth",
"udp": true
}
},
// http/https proxy
{
"tag": "http",
"port": 801,
@@ -42,7 +79,7 @@
],
"routeOnly": false
},
// settings of inbound `protocol` (see above)
// settings of inbound "protocol" (see above)
"settings": {
"auth": "noauth",
"udp": true
@@ -105,6 +142,13 @@
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
},
{
"type": "field",
"domain": [