Skip to content

API: Add ListInbounds and ListOutbounds #4723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 6, 2025

Conversation

gsergey418
Copy link
Contributor

Fixes #2745. Add the ListInbounds and ListOutbounds methods to the gRPC HandlerService and write the respective CLI commands lsi and lso.

@gsergey418 gsergey418 marked this pull request as ready for review May 14, 2025 13:09
@gsergey418
Copy link
Contributor Author

gsergey418 commented May 14, 2025

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"
        }
    ]
}

@gsergey418
Copy link
Contributor Author

gsergey418 commented May 14, 2025

Opened a PR to the documentation. Similar changes needed in Chinese version and https://github.com/XTLS/Xray-API-documents.

@Fangliding
Copy link
Member

Could you set protoc and protoc-gen-go to the same version as in the core?

@gsergey418
Copy link
Contributor Author

@Fangliding Done

@RPRX RPRX changed the title feat(api): Add ListInbounds and ListOutbounds to the gRPC API API: Add ListInbounds and ListOutbounds Jun 6, 2025
@RPRX RPRX merged commit af7a76d into XTLS:main Jun 6, 2025
39 checks passed
@RPRX
Copy link
Member

RPRX commented Jun 6, 2025

看起来不会损坏现有功能,先合了,感谢 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC APIs for list of inbounds and users
3 participants