Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

Xray v1.5.9无法对ss-2022进行user流量统计

Open jjlizz opened this issue 3 years ago • 5 comments
trafficstars

Xray版本

服务端与客户端均为v1.5.9

服务端配置(以chacha20为例)

{
  "log": {
    "error": "/var/log/xray/error.log",
    "access": "/var/log/xray/access.log",
    "loglevel": "warning"
  },
  "dns": {
    "hosts": {
      "domain:googleapis.cn": "googleapis.com"
    },
    "servers": [
      "https+local://dns.cloudflare.com/dns-query",
      "https+local://dns.google/dns-query",
      "1.1.1.1",
      "8.8.8.8"
    ]
  },
  "stats": {},
  "api": {
    "tag": "api",
    "services": [
      "StatsService"
    ]
  },
  "policy": {
    "levels": {
      "1": {
        "statsUserUplink": true,
        "statsUserDownlink": true
      }
    },
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true,
      "statsOutboundUplink": true,
      "statsOutboundDownlink": true
    }
  },
  "inbounds": [
    {
      "protocol": "shadowsocks",
      "port": ,
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "method": "xchacha20-ietf-poly1305",
        "password": "",
        "network": "tcp,udp",
        "level": 1,
        "email": "[email protected]"
      },
      "tag": "ss_aead"
    },
    {
      "protocol": "shadowsocks",
      "port": ,
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "method": "2022-blake3-chacha20-poly1305",
        "password": "",
        "network": "tcp,udp",
        "level": 1,
        "email": "[email protected]"
      },
      "tag": "ss_2022"
    },
    {
      "listen": "127.0.0.1",
      "port": 10086,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      },
      "tag": "api"
    }
  ],
  "outbounds": [
    {
      "settings": {},
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "settings": {},
      "protocol": "blackhole",
      "tag": "blocked"
    }
  ],
  "routing": {
    "rules": [
      {
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api",
        "type": "field"
      }
    ],
    "domainStrategy": "AsIs"
  },
  "reverse": {},
  "transport": {}
}

流量统计日志

root@***:~# xray api statsquery --server=127.0.0.1:10086
{
    "stat": [
        {
            "name": "inbound>>>api>>>traffic>>>uplink",
            "value": "1530"
        },
        {
            "name": "inbound>>>api>>>traffic>>>downlink",
            "value": "5043"
        },
        {
            "name": "user>>>[email protected]>>>traffic>>>uplink",
            "value": "251959"
        },
        {
            "name": "user>>>[email protected]>>>traffic>>>downlink",
            "value": "35458019"
        },
        {
            "name": "inbound>>>ss_aead>>>traffic>>>uplink",
            "value": "274117"
        },
        {
            "name": "inbound>>>ss_aead>>>traffic>>>downlink",
            "value": "35386490"
        },
        {
            "name": "inbound>>>ss_2022>>>traffic>>>uplink",
            "value": "4307080"
        },
        {
            "name": "inbound>>>ss_2022>>>traffic>>>downlink",
            "value": "4338662"
        },
        {
            "name": "outbound>>>direct>>>traffic>>>uplink",
            "value": "4516369"
        },
        {
            "name": "outbound>>>direct>>>traffic>>>downlink",
            "value": "39778440"
        },
        {
            "name": "outbound>>>blocked>>>traffic>>>uplink",
            "value": "0"
        },
        {
            "name": "outbound>>>blocked>>>traffic>>>downlink",
            "value": "0"
        }
    ]
}

现象描述

根据日志可以看到使用api可以正常统计ss-aead和ss-2022的inbound流量,也可以正常统计ss-aead的user流量,但无法统计ss-2022的user流量

jjlizz avatar Jul 16 '22 05:07 jjlizz

你可用 ` 3个连续这符号 ,看起方便点

代码

chika0801 avatar Jul 16 '22 05:07 chika0801

试了一下无法复现 ~~真的升级 159 了嘛~~ 升级之后要产生一些流量以后再试

yuhan6665 avatar Jul 16 '22 12:07 yuhan6665

试了一下无法复现 ~真的升级 159 了嘛~ 升级之后要产生一些流量以后再试 虽说在issue里我是用了双端1.5.9为例,但是这个bug实际上1.5.6就有,我用过1.5.6,1.5.8,1.5.9,都是完全一样的现象,至于是否产生流量,inbound里ss-2022已经很明显产生流量了,可是并没有出现对应的user流量

jjlizz avatar Jul 16 '22 13:07 jjlizz

这个可能更明显一些,inbound和outbound都有大量流量,user则是完全没有

root@***:~# xray
Xray 1.5.9 (Xray, Penetrates Everything.) Custom (go1.18.4 linux/amd64)
A unified platform for anti-censorship.
2022/07/16 21:15:07 Using config from STDIN
2022/07/16 21:15:07 [Info] infra/conf/serial: Reading config: stdin:
^C
root@***:~# xray api statsquery --server=127.0.0.1:10086
{
    "stat": [
        {
            "name": "inbound>>>api>>>traffic>>>downlink",
            "value": "322574"
        },
        {
            "name": "outbound>>>japan>>>traffic>>>uplink",
            "value": "0"
        },
        {
            "name": "inbound>>>ss>>>traffic>>>uplink",
            "value": "189225"
        },
        {
            "name": "outbound>>>direct>>>traffic>>>uplink",
            "value": "170132"
        },
        {
            "name": "inbound>>>dmmbackup>>>traffic>>>uplink",
            "value": "1571"
        },
        {
            "name": "inbound>>>dmmbackup>>>traffic>>>downlink",
            "value": "4843"
        },
        {
            "name": "outbound>>>blocked>>>traffic>>>uplink",
            "value": "0"
        },
        {
            "name": "inbound>>>balance>>>traffic>>>uplink",
            "value": "1646"
        },
        {
            "name": "inbound>>>balance>>>traffic>>>downlink",
            "value": "4844"
        },
        {
            "name": "inbound>>>api>>>traffic>>>uplink",
            "value": "77986"
        },
        {
            "name": "outbound>>>direct>>>traffic>>>downlink",
            "value": "68692854"
        },
        {
            "name": "outbound>>>blocked>>>traffic>>>downlink",
            "value": "0"
        },
        {
            "name": "outbound>>>japan>>>traffic>>>downlink",
            "value": "0"
        },
        {
            "name": "inbound>>>ss>>>traffic>>>downlink",
            "value": "68854032"
        }
    ]
}

jjlizz avatar Jul 16 '22 13:07 jjlizz

vless监听443端口反代回落也无获取443端口用户的流量,回落其他端口的用户流量可以获取到。跟上面描述的一样,443端口的用户获取不到流量信息,443端口有流量。50000端口的用户或者端口都有流量信息 { "api": { "services": [ "HandlerService", "LoggerService", "StatsService" ], "tag": "api" }, "inbounds": [ { "listen": "127.0.0.1", "port": 8080, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" }, "tag": "api" }, { "listen": "0.0.0.0", "port": 443, "protocol": "vless", "settings": { "clients": [ { "email": "[email protected]", "flow": "xtls-rprx-direct", "id": "xx-xx-xx-xx-xx", "level": 0 } ], "decryption": "none", "fallbacks": [ { "dest": 80 }, { "dest": 50000, "path": "/path", "xver": 1 } ] }, "sniffing": { "destOverride": [ "http", "tls" ], "enabled": true }, "streamSettings": { "network": "tcp", "security": "xtls", "xtlsSettings": { "alpn": [ "http/1.1" ], "certificates": [ { "certificateFile": "/etc/ssl/xray/fullchain.cer", "keyFile": "/etc/ssl/xray/fullchain.key" } ] } }, "tag": "443" }, { "listen": "127.0.0.1", "port": 50000, "protocol": "vmess", "settings": { "clients": [ { "email": "[email protected]", "id": "97ddb226-f540-d3ad-ecdb-463256f84690", "level": 0 } ], "disableInsecureEncryption": false }, "sniffing": { "destOverride": [ "http", "tls" ], "enabled": true }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "acceptProxyProtocol": true, "path": "/path" } }, "tag": "50000" } ], "log": { "access": "/var/log/xray/access.log", "error": "/var/log/xray/error.log", "loglevel": "warning" }, "outbounds": [ { "protocol": "freedom", "settings": {}, "tag": "freedom" }, { "protocol": "blackhole", "settings": {}, "tag": "blocked" } ], "policy": { "levels": { "0": { "statsUserDownlink": true, "statsUserUplink": true } }, "system": { "statsInboundDownlink": true, "statsInboundUplink": true } }, "routing": { "rules": [ { "inboundTag": [ "api" ], "outboundTag": "api", "type": "field" }, { "ip": [ "geoip:private" ], "outboundTag": "blocked", "type": "field" }, { "outboundTag": "blocked", "protocol": [ "bittorrent" ], "type": "field" } ] }, "stats": {} }

langzisuifeng avatar Sep 20 '22 06:09 langzisuifeng