Closed PouriaMzn closed 3 months ago
Hi , add each client tag like
"email": "general@vless-tcp-xtls", "level": 0
and restart vps
Hi , add each client tag like
"email": "general@vless-tcp-xtls", "level": 0
and restart vps
Thanks for your answer.
Actually, I'm using email and level for the clients, I updated my original post so you could see better what's going on. I'm using a multi-protocol and multi-user on a single port in my server according to this wonderful example, but I still get failed to dial 127.0.0.1:10086
error.
check this command xray api statsquery --server=127.0.0.1:10086 -pattern ''
ss -lptn 'sport = :10086'
still get the same error
this config worked for me { "log": { "access": "/var/log/xray/access.log", "error": "/var/log/xray/error.log", "loglevel": "warning" }, "api": { "services": [ "HandlerService", "LoggerService", "StatsService" ], "tag": "api" }, "stats": {}, "policy": { "levels": { "0": { "statsUserUplink": true, "statsUserDownlink": true } }, "system": { "statsInboundUplink": true, "statsInboundDownlink": true, "statsOutboundUplink": true, "statsOutboundDownlink": true } }, "inbounds": [ { "listen": "127.0.0.1", "port": 10085, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" }, "tag": "api", "sniffing": null }, { "tag": "Vless-TCP-XTLS", "port": 443, "protocol": "vless", "settings": { "clients": [ { "email": "general@vless-tcp-xtls", "id": "91c2df6b-02cf-4067-b9b5-526aabb6bd03", "flow": "xtls-rprx-direct", "level": 0 }, { "email": "v1@vless-tcp-xtls", "id": "2b0927a1-e309-4e52-aa41-26ee8e46b2a9", "flow": "xtls-rprx-direct", "level": 0 }, { "email": "v2@vless-tcp-xtls", "id": "35be2e9d-94ef-404d-b3e4-15c75f502a33", "flow": "xtls-rprx-direct", "level": 0 },
],
"decryption": "none",
"fallbacks": [
{
"dest": 60000,
"alpn": "",
"xver": 1
},
{
"dest": 60001,
"alpn": "h2",
"xver": 1
},
{
"dest": 60002,
"path": "/c78e/",
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"minVersion": "1.2",
"certificates": [
{
"certificateFile": "/usr/local/etc/xray/self_signed_cert.pem",
"keyFile": "/usr/local/etc/xray/self_signed_key.pem"
},
{
"certificateFile": "/ssl/xray.crt",
"keyFile": "/ssl/xray.key"
}
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": 60002,
"listen": "127.0.0.1",
"protocol": "vless",
"settings": {
"clients": [
{
"email": "general@vless-tcp-xtls",
"id": "91c2df6b-02cf-4067-b9b5-526aabb6bd03",
"flow": "xtls-rprx-direct",
"level": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"acceptProxyProtocol": true,
"path": "/c78e/"
}
}
}
], "outbounds": [ { "protocol": "freedom" } ], "routing": { "rules": [ { "inboundTag": [ "api" ], "outboundTag": "api", "type": "field" } ], "domainStrategy": "AsIs" } }
check this and then add other protocols
Hi @alisalmani
Thank you for the example. That works perfectly on the server.
1) Is it possible to query how much traffic your user with the email v1@vless-tcp-xtls
has utilised? How can I do that?
2) I can run xray api statsquery --server=127.0.0.1:10085
and xray api statssys --server=127.0.0.1:10085
on my server. But xray api stats --server=127.0.0.1:10085
fails with the error: failed to get stats: rpc error: code = Unknown desc = app/stats/command: not found.
Do you know why?
Thanks
hi @houmie use this for all users traffic: xray api statsquery --server=127.0.0.1:10085 -pattern '' now i can not check it but maybe it work xray api statsquery --server=127.0.0.1:10085 'v1@vless-tcp-xtls'
Hi @alisalmani
Thank you so much. Yes, xray api statsquery --server=127.0.0.1:10085 -pattern general@vless-tcp-xtls
works well.
I have one more question for you. Is there a way to measure the traffic on the client as well?
I have created this client config, but it times out trying to connect to dokodemo-door at 127.0.0.1:10085 on iPhone. I wonder why.
{
"api": {
"services": [
"HandlerService",
"LoggerService",
"StatsService"
],
"tag": "api"
},
"stats": {},
"policy": {
"levels": {
"0": {
"statsUserUplink": true,
"statsUserDownlink": true,
"handshake": 3,
"connIdle": 180
}
},
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true,
"statsOutboundUplink": true,
"statsOutboundDownlink": true
}
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api",
"sniffing": null
},
{
"listen": "[::1]",
"port": 8080,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"excludedDomains": [],
"metadataOnly": false,
"routeOnly": false
},
"tag": "socks-in"
}
],
"outbounds": [
{
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "xxx.xxx.xxx.xx",
"port": 443,
"users": [
{
"encryption": "none",
"flow": "xtls-rprx-vision",
"id": "8652b34d-a236-4eca-8a08-b30ea4e63cba"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"realitySettings": {
"fingerprint": "chrome",
"publicKey": "eGZ4cJLCFo8gqCkFGuwxCRVx8FE3R2vh__uqCFZg6RM",
"serverName": "www.google-analytics.com",
"shortId": "1ad99ba959dec1a9",
"show": false,
"spiderX": ""
},
"security": "reality",
"tcpSettings": {
"header": {
"type": "none"
}
}
},
"tag": "proxy"
},
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block"
}
],
"routing": {
"balancers": [],
"domainMatcher": "hybrid",
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
},
{
"__enabled__": true,
"__id__": "E88ACF9A-E85D-4C03-B2BF-43D0513613F3",
"__name__": "Rule_E88ACF9A-E85D-4C03-B2BF-43D0513613F3",
"domainMatcher": "hybrid",
"network": "udp,tcp,",
"outboundTag": "block",
"protocol": [
"bittorrent"
],
"type": "field"
}
]
}
}
Hi @houmie you do not need api part in client side it's work only on server remove this part from your client config { "listen": "127.0.0.1", "port": 10085, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" }, "tag": "api", "sniffing": null },
Hi @alisalmani
I see. Thank you. I have removed it as you suggested but it still fails.
I'm using this official Xray wrapper for iOS. There is this Go function QueryStats() that is supposed to show the traffic stats.
I have tried everything, but it fails on this line with context deadline exceeded
when it tries to connect. The maintainer of that wrapper is sure that this function is working. So it must be something with my configuration.
Not sure, if this is in your expertise field, I would love to hear your opinion. :-) But please don't worry if you don't know the answer.
Many Thanks
@PouriaMzn, In my case, what stopped me from API connection was this rule:
{
"ip": [
"geoip:private"
],
"outboundTag": "blocked",
"type": "field",
"tag": "private"
}
Hello everyone, I'm using
Xray 1.7.2
and I have a problem using the API, here is my config:But when I use for example
xray api statssys --server=127.0.0.1:10086
i get this error:failed to dial 127.0.0.1:10086
Somehow, I cannot connect to the API service. When I usess -lptn 'sport = :10086'
it shows that indeed Xray is listening on port 10086. I used different ports and still got the same error. I also used the bash script according to the documentation and still the same error show upI wanted to know if my config is wrong or is this a bug?!