feat: allow mapping multiple domain names to single ip #763
+191
−72
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
当前dae通过观测dns请求来实现domain的路由,例如观测到
google.com
的地址为46.82.174.69
,则内核部分会将46.82.174.69
当作google.com
处理,并且用户态会直接计算每条domain规则的匹配结果并直接注入但假设一种情况,
api.bilibili.com
和cm.bilibili.com
均使用ip61.240.206.12
,dae会将61.240.206.12
视为最后一次dns查询时的域名,并通过将ttl设置为0并期待每次产生连接前都产生一次dns查询不过假如客户端完全不尊重ttl,那么一切就都乱套了,例如希望对
api.bilibili.com
和cm.bilibili.com
应用不同的路由,那么这将完全不工作本PR设想了一种全新的方法,完全不依赖TTL,即如果
api.bilibili.com
和cm.bilibili.com
具有相同的路由(即,同时匹配同一个domain规则),则直接路由61.240.206.12,否则则强制跳入用户态依赖sniff进行重新路由Checklist
目前还非常粗糙,需要充分测试
Full Changelogs
Issue Reference
Closes #[issue number]
Test Result