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

rpc 开放的接口能写一些文档吗

Open lionel-coderm opened this issue 3 years ago • 2 comments

我想用 java 来调用 xray rpc 接口,但是在我工程里作为客户端调 xray 接口的时候,比如 addInbound 接口,grpc 接口需要在 AddInboundRequest 对象里构建一个 InboundHandlerConfig 对象,InboundHandlerConfig 对象里参数不是很清楚,不知道传一些什么参数,希望大佬给予解惑

lionel-coderm avatar Aug 09 '22 10:08 lionel-coderm

Tag 就直接写没错 TypedMessage 可能需要从 receiverconfig 转换 跟 go 相似吧 https://github.com/crossfw/Xray-API-documents/blob/eb3b152dfda6e3503667be426b3caebe61bc81d5/examples/addInbound.go#L28

yuhan6665 avatar Aug 09 '22 13:08 yuhan6665

对就是 ReceiverSettings 这个参数和 ProxySettings 这两个参数不明白是做什么,具体有什么用,对应到 config.json配置文件里的字段是什么。 然后还有就是 ReceiverSettings 和 ProxySettings 这两个值的类型都是 TypedMessage 这个类型,然后就又不知所措了,TypedMessage 里的两个参数一个是 String 类型的 type,然后一个是 ByteString 类型的 value,那 type 代表什么?value 又是什么? 代码如下:写到这里就不知道怎么构建这两个参数了

        InboundHandlerConfig inboundHandlerConfig = InboundHandlerConfig.newBuilder()
                .setTag("api")
                .setReceiverSettings(TypedMessage.newBuilder().setType("xxx").setValue(bytes1))
                .setProxySettings(TypedMessage.newBuilder())
                .build();

最后万分感谢解答,对go还不是很熟悉,请见谅

lionel-coderm avatar Aug 09 '22 13:08 lionel-coderm