feat(api): Add ListInbounds and ListOutbounds to the gRPC API
Fixes #2745. Add the ListInbounds and ListOutbounds methods to the gRPC HandlerService and write the respective CLI commands lsi and lso.
Got it to work, added both methods, wrote a test and added the corresponding CLI commands. Expaneded two interfaces marked as xray:api:stable: features/inbound and features/outbound. May not be the best solution as I'm not very familiar with the codebase, so feel free to correct me. Currently it works like this:
$ ./xray api lsi -s localhost:1081
{
"inbounds": [
{
"proxySettings": {
"_TypedMessage_": "xray.proxy.http.ServerConfig",
"accounts": {
"gsergey418": "REDACTED"
}
},
"receiverSettings": {
"_TypedMessage_": "xray.app.proxyman.ReceiverConfig",
"listen": "127.0.0.1",
"portList": 1080
},
"tag": "http"
}
]
}
$ ./xray api lso -s localhost:1081
{
"outbounds": [
{
"proxySettings": {
"_TypedMessage_": "xray.proxy.freedom.Config"
},
"senderSettings": {
"_TypedMessage_": "xray.app.proxyman.SenderConfig"
},
"tag": "direct"
},
{
"proxySettings": {
"_TypedMessage_": "xray.proxy.vless.outbound.Config",
"vnext": [
{
"address": "REDACTED",
"port": 10086,
"user": [
{
"account": {
"_TypedMessage_": "xray.proxy.vless.Account",
"encryption": "none",
"id": "REDACTED"
}
}
]
}
]
},
"senderSettings": {
"_TypedMessage_": "xray.app.proxyman.SenderConfig",
"streamSettings": {
"protocolName": "tcp",
"socketSettings": {}
}
},
"tag": "proxy"
},
{
"proxySettings": {
"_TypedMessage_": "xray.proxy.blackhole.Config"
},
"senderSettings": {
"_TypedMessage_": "xray.app.proxyman.SenderConfig"
},
"tag": "block"
}
]
}
Opened a PR to the documentation. Similar changes needed in Chinese version and https://github.com/XTLS/Xray-API-documents.
Could you set protoc and protoc-gen-go to the same version as in the core?
@Fangliding Done
看起来不会损坏现有功能,先合了,感谢 PR
Got it to work, added both methods, wrote a test and added the corresponding CLI commands. Expaneded two interfaces marked as
xray:api:stable:features/inboundandfeatures/outbound. May not be the best solution as I'm not very familiar with the codebase, so feel free to correct me. Currently it works like this:$ ./xray api lsi -s localhost:1081 { "inbounds": [ { "proxySettings": { "_TypedMessage_": "xray.proxy.http.ServerConfig", "accounts": { "gsergey418": "REDACTED" } }, "receiverSettings": { "_TypedMessage_": "xray.app.proxyman.ReceiverConfig", "listen": "127.0.0.1", "portList": 1080 }, "tag": "http" } ] } $ ./xray api lso -s localhost:1081 { "outbounds": [ { "proxySettings": { "_TypedMessage_": "xray.proxy.freedom.Config" }, "senderSettings": { "_TypedMessage_": "xray.app.proxyman.SenderConfig" }, "tag": "direct" }, { "proxySettings": { "_TypedMessage_": "xray.proxy.vless.outbound.Config", "vnext": [ { "address": "REDACTED", "port": 10086, "user": [ { "account": { "_TypedMessage_": "xray.proxy.vless.Account", "encryption": "none", "id": "REDACTED" } } ] } ] }, "senderSettings": { "_TypedMessage_": "xray.app.proxyman.SenderConfig", "streamSettings": { "protocolName": "tcp", "socketSettings": {} } }, "tag": "proxy" }, { "proxySettings": { "_TypedMessage_": "xray.proxy.blackhole.Config" }, "senderSettings": { "_TypedMessage_": "xray.app.proxyman.SenderConfig" }, "tag": "block" } ] }
Hi @gsergey418!
As i see from your example CLI response ./xray api lsi -s localhost:1081 also return list of users of inbounds? Are you sure that it is good option? What if inbound will have 50k+ users?
Maybe there should be an option to just get list of inbounds without users?