Add the routing management gRPC API
参照handlerService写了一份控制路由的grpc api。
支持使用gRPC 增加 删除 改变 RuleObject,BalancerObject。风格基本与handlerservice一致。
原本的RuleObject没有tag属性,此次修改增加了tag属性。用于控制从配置文件加入的RuleObject,不填tag属性时会采用uuid作为RuleObject的tag。原本RuleObject的tag标签改为TargetTag。
Test Case只完成了RuleObject相关的。BalancerObject由于不会添加Outbound所以未能完成。
为啥三个test check过不了。
测试了commit 4e63c22197683deebb6adc91ebef6b7796131b64 也是一样无法通过
4e63c22197683deebb6adc91ebef6b7796131b64
FAIL github.com/xtls/xray-core/app/router [build failed]
4e63c22197683deebb6adc91ebef6b7796131b64FAIL github.com/xtls/xray-core/app/router [build failed]
缺少geoip.dat文件导致的test测试不过。
panic: open D:\Xray-core\resources\geoip.dat: The system cannot find the path specified.
goroutine 1 [running]:
github.com/xtls/xray-core/common.Must(...)
D:/Xray-core/common/common.go:26
github.com/xtls/xray-core/app/router_test.init.0()
D:/Xray-core/app/router/condition_geoip_test.go:21 +0x42c
FAIL github.com/xtls/xray-core/app/router 0.272s
4e63c22197683deebb6adc91ebef6b7796131b64FAIL github.com/xtls/xray-core/app/router [build failed]缺少
geoip.dat文件导致的test测试不过。panic: open D:\Xray-core\resources\geoip.dat: The system cannot find the path specified. goroutine 1 [running]: github.com/xtls/xray-core/common.Must(...) D:/Xray-core/common/common.go:26 github.com/xtls/xray-core/app/router_test.init.0() D:/Xray-core/app/router/condition_geoip_test.go:21 +0x42c FAIL github.com/xtls/xray-core/app/router 0.272s
测试前应该先将 geoip.dat 和 geosite.dat 放入 resources 目录下,GitHub Actions 中的测试完成了此项工作
4e63c22197683deebb6adc91ebef6b7796131b64FAIL github.com/xtls/xray-core/app/router [build failed]缺少
geoip.dat文件导致的test测试不过。panic: open D:\Xray-core\resources\geoip.dat: The system cannot find the path specified. goroutine 1 [running]: github.com/xtls/xray-core/common.Must(...) D:/Xray-core/common/common.go:26 github.com/xtls/xray-core/app/router_test.init.0() D:/Xray-core/app/router/condition_geoip_test.go:21 +0x42c FAIL github.com/xtls/xray-core/app/router 0.272s测试前应该先将
geoip.dat和geosite.dat放入resources目录下,GitHub Actions 中的测试完成了此项工作
Windows 环境测试通过,Macos和ubuntu无法测试通过。
@tat5522
感谢您的贡献,有几个需要注意的地方需要说明:
- Map
- 一些代码需要格式化(import)。
- 我个人认为不应修改单个路由规则,而是直接修改整体。
因此,我暂时将此 PR 修改为 work in progress。
@tat5522
感谢您的贡献,有几个需要注意的地方需要说明:
- Map
- 一些代码需要格式化(import)。
- 我个人认为不应修改单个路由规则,而是直接修改整体。
因此,我暂时将此 PR 修改为 work in progress。
Map已修改为Slice,取出时采用遍历方式取出需要的RuleObject。
Import的格式化,需要什么格式的?Windows下开发使用go fmt ./...命令格式化似乎会遇到换行符CRLF问题。
修改整体采用API似乎不太容易做到控制单一路由。
@tat5522
感谢贡献。请在 https://github.com/XTLS/Xray-core/issues/414 中充分讨论后再继续完成此 API。