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

loopback 出口不支持统计

Open phoenixxie0 opened this issue 1 year ago • 2 comments

完整性要求

  • [X] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • [x] 我提供了完整的配置文件和日志,而不是出于自己的判断只给出截取的部分。
  • [X] 我搜索了issues,没有发现已提出的类似问题。

版本

1.8.23

描述

loopback 出口不支持统计

重现方式

/opt/share/xray/xray api stats --server=127.0.0.1:10085 -name "outbound>>>traffic-cn>>>traffic>>>uplink" /opt/share/xray/xray api stats --server=127.0.0.1:10085 -name "outbound>>>traffic-cn>>>traffic>>>downlink"

客户端配置

服务端配置


    "outbounds": [
        {
            "protocol": "freedom", 
            "settings": {
            }, 
            "tag": "direct"
        }, 
        {
            "protocol": "loopback", 
            "settings": {
                "inboundTag": "traffic-input-cn"
            }, 
            "tag": "traffic-cn"
        }, 
        ],
        "routing": {
        "domainStrategy": "IPIfNonMatch", 
        "domainMatcher": "hybrid", 
        "balancers": [
            {
                "tag": "warp-balancer", 
                "selector": [
                    "wireguard",
                    "warp-socks5"
                ],
                "strategy": {
                      "type": "roundRobin"
                }
            }
        ], 
        "rules": [
            {
                "type": "field", 
                "inboundTag": ["api"], 
                "outboundTag": "api"
            }, 
            {
                "type": "field", 
                "inboundTag": ["xtls","vless","vmss"],
                "domain": [
                    "geosite:category-ads"
                ], 
                "outboundTag": "blocked"
            }, 
            {
                "type": "field",
                "inboundTag": ["xtls","vless","vmss"],
                "ip": [
                    "geoip:cn"
                ],
                "outboundTag": "traffic-cn"
            },
            {
                "type": "field", 
                "inboundTag": ["xtls","vless","vmss"],
                "domain": [
                    "geosite:cn"
                ], 
                "outboundTag": "traffic-cn"
            },
            {
                "inboundTag": ["traffic-input-cn"],
                "balancerTag": "warp-balancer"
            },

客户端日志

服务端日志

phoenixxie0 avatar Aug 07 '24 12:08 phoenixxie0

完整配置

Fangliding avatar Aug 07 '24 17:08 Fangliding

{ "log": { "access": "/opt/share/xray/log/access.log", "error": "/opt/share/xray/log/error.log", "loglevel": "warring" }, "policy": { "levels": { "0": { "statsUserUplink": true, "statsUserDownlink": true } }, "system": { "statsInboundUplink": true, "statsInboundDownlink": true, "statsOutboundUplink": true, "statsOutboundDownlink": true } }, "dns": { "servers": [ { "address": "8.8.4.4", "port": 53, "clientIp": "x", "domains": [ "geosite:cn" ], "expectIPs": [ "geoip:cn" ] }, "1.1.1.1", "tcp+local://8.8.8.8:53", "quic+local://dns.adguard.com", "https+local://dns.google/dns-query", "https+local://1.0.0.1/dns-query" ] }, "stats": { }, "api": { "tag": "api", "services": [ "HandlerService", "LoggerService", "StatsService" ] }, "inbounds": [ { "listen": "0.0.0.0", "port": 8118, "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1" }, "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "tag": "socks-in" }, { "listen": "127.0.0.1", "port": 10085, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" }, "tag": "api" } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "loopback", "settings": { "inboundTag": "traffic-input-cn" }, "tag": "traffic-cn" }, { "protocol": "socks", "settings": { "servers": [ { "address": "x", "port": 40000 } ], "domainStrategy": "UseIPv6v4" }, "tag": "warp-socks5" }, { "protocol": "wireguard", "settings": { "secretKey": "x", "address": [ "x" ], "peers": [ { "endpoint": "x", "publicKey": "x", "AllowedIPs": ["0.0.0.0/0","::/0"], "keepAlive": 29 } ], "kernelMode": false, "mtu": 1420, "workers": 2, "domainStrategy": "ForceIPv6v4" }, "tag": "wireguard" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ], "routing": { "domainStrategy": "IPIfNonMatch", "domainMatcher": "hybrid", "balancers": [ { "tag": "warp-balancer", "selector": [ "wireguard", "warp-socks5" ], "strategy": { "type": "roundRobin" } } ], "rules": [ { "type": "field", "inboundTag": ["api"], "outboundTag": "api" }, { "type": "field", "inboundTag": ["socks-in"], "domain": [ "geosite:category-ads" ], "outboundTag": "blocked" }, { "type": "field", "inboundTag": ["socks-in"], "ip": [ "geoip:cn" ], "outboundTag": "traffic-cn" }, { "type": "field", "inboundTag": ["socks-in"], "domain": [ "geosite:cn" ], "outboundTag": "traffic-cn" }, { "inboundTag": ["traffic-input-cn"], "balancerTag": "warp-balancer" }, { "type": "field", "inboundTag": ["socks-in"], "domain": [ "geosite:instagram"" ], "balancerTag": "warp-balancer" } ] }, "observatory": { "probeInterval": "36s", "subjectSelector": [ "wireguard", "warp-socks5" ], "enableConcurrency": true, "probeURL": "x", "probeInterval": "1m" } }

phoenixxie0 avatar Aug 07 '24 18:08 phoenixxie0

这个协议不出核心 所以导致不会记录 强行支持需要套娃恐怕会降低这个出站的效率 和它本身的目的相悖 而且可能导致一些未知的问题 一些实现不标准的出站也有这个问题 比如wireguard 先unplanned吧

Fangliding avatar Aug 30 '24 04:08 Fangliding