-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Routing: Serialize matcher for iOS #5505
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
base: main
Are you sure you want to change the base?
Conversation
|
ready to test. |
配置文件内 Routing 加个配置项来指定名称吧,同时也是开启该功能的标志,不然开多个 Xray 会炸,DNS 的你也看一下 |
|
@yiguodev libXray 或许需要更新 BuildDomainMatcherCache() |
|
本来以为 mmap 是把磁盘空间当运行内存用结果它确实是懒加载,不知道会不会像 swap,不过仍然 https://t.me/projectXtls/1384
有了这项优化,前面的 123 全被解决了, |
|
@iambabyninja 要测试的是这个 PR, |
I've implemented serialization for MphMatcherGroup and the memory usage decreased.
Same rules, This PR : 22 MB, Serialized : 14-15 MB
So far, I've done the following:
• Added a function to prebuild matchers from the config, keyed by ruleTag
• Serialized all rule matchers and saved them to a file
• Loaded the serialized data via mmap and applied it directly to routing conditions
• Add
xray.cached.matcherflag for apply matcher form file• Add function for build the matcher.cache from config json string (BuildDomainMatcherCache to RouterConfig)
#5488 (comment)
@RPRX @iambabyninja @mangustyura
Details :
1- required rules to have ruleTag :
{ "domain" : [ "domain:alidns.com", "domain:doh.pub", "domain:dot.pub", "domain:360.cn", "domain:onedns.net", "geosite:cn" ], "outboundTag" : "direct", "ruleTag" : "rule-1" }, { "ip" : [ "223.5.5.5", "223.6.6.6", "2400:3200::1", "2400:3200:baba::1", "geoip:cn" ], "outboundTag" : "direct", "ruleTag" : "rule-2" }2- Cached file should be alongside the geofiles and file name should be
matcher.cache3- Sample code for pre-built domain matcher :