feat: allow mapping multiple domain names to single ip#763
feat: allow mapping multiple domain names to single ip#763LostAttractor wants to merge 3 commits intodaeuniverse:mainfrom
Conversation
jschwinger233
left a comment
There was a problem hiding this comment.
Lint 挂了,你在混用 tab 和 space。
volatile 是因为原本就这么写了,我其实不知道这意味着什么 |
2d263ab to
ef810b2
Compare
已经修复 |
4dd0103 to
8b8a68a
Compare
| (domain_routing->bitmap[index / 32] >> (index % 32)) & 1) | ||
| ctx->isdns_must_goodsubrule_badrule |= 0b10; | ||
| (domain_routing->bitmap[index / 32] >> (index % 32)) & 1) { | ||
| // All domains mapeed by the current IP address are matched. |
| if !badRule { | ||
| if outbound == consts.OutboundControlPlaneRouting { | ||
| continue | ||
| } |
There was a problem hiding this comment.
我记得这个函数要和 bpf 的逻辑一致,这个修改在 bpf 里貌似没有?
| if !exists { | ||
| newBumpMap = make([]uint32, consts.MaxMatchSetLen) | ||
| } | ||
| for index := 0; index < consts.MaxMatchSetLen; index++ { |
There was a problem hiding this comment.
似乎有点浪费 cpu 了,大部分用户的规则都不会超过 100 条吧,这里 MaxMatchSetLen 是 1024,可以做个短路 break
| // jump to control plane. | ||
| need_control_plane_routing = true; | ||
| } | ||
| } |
There was a problem hiding this comment.
这一段逻辑也应该更新到 routing_matcher_userspace.go:Match() ?
| bool must = ctx->must || match_set->must; | ||
|
|
||
| if (!must && ctx->isdns) { | ||
| if ((!must && ctx->isdns) || need_control_plane_routing) { |
|
Any updates? |
|
Any updates? |
23337ce
|
求更新 |
Note The following content has been translated from its original language using an automated process powered by a proprietary API. Segments originally written in English have been preserved, while non-English portions have been machine-translated for readability. Please be aware that minor inaccuracies may exist due to the automated nature of the translation. Request for an update. |
|
Are there any plans for mergers in the future? |
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