feat(config): wildcard lan interface name support #729
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
#724
Checklist
Full Changelogs
实现了 #724 的请求,现在支持了对于 lan_interfaces的匹配支持。
匹配规则支持 + 匹配一个字符,* 匹配多个字符。
代码变化
主要变动的是匹配部分,首先入口变成了
bindLanWildcard
内部实现是,首先根据匹配的 pattern 来匹配。如果不是 pattern 就只绑定单独的if。
给
addNewLinkBindLanCb
方法添加了一个keep bool
参数来决定是否需要持续监听。另外就是 bindLan 方法的变化。因为全局已经有一个 通过监听匹配表达式的监听回调,所以用一个参数表面如果监听删除的网卡是来自 wildcard 就不添加新的监听了。
最后,文档将在合并后添加。谢谢各位开发者的耐心查看代码。
另外还有个小问题,个人未修复(不知道咋修)。具体表现为,在一个被泛型匹配到的网卡被删除后,会报错
[Jan 04 16:49:01] ERROR addQdisc: Link not found
往提出修改意见修复(小bug 不影响使用)。
Issue Reference
#724
Test Result
在我的电脑工作正常。
帖一个测试脚本