Expand description
auth/commconfig — 拆 commconfig.rs 1123 → commconfig/{mod, 5 子}.rs (v1.4.110 CC Batch M)
C++ PullCommonConfigV2() 对齐:动态拉取后台 IP 池 + 配置, 比 DNS / 硬编码
更权威 (guaranteed_ip_for_conn 按 ConnIdentity 分组).
子模块:
types: 6 type alias + 9 const (CONN_WEB_*) + 2 struct (ForcedIpEntry, CommonConfigSnapshot)totp: base32_decode + gen_totp_sha1 (Google Authenticator 风格 6 digit)parsers: api_root + fetch_page + 4 parse_* + value_kind + is_*_identityfetch: fetch_all (主入口) + SharedCommConfig + empty_snapshot + spawn_refresheraccessors: forced_ip_for_attribution + 3 ips_for_* + webtcp_hardcoded_addrs + 3 identity 派生tests: 单元测试 (内容不变, 已 split sibling)
Parent auth/mod.rs pub mod commconfig; 路径不变 (mod.rs re-export 全 pub 项).
Structs§
- Common
Config Snapshot - CommConfig 协议返回的完整快照(含过期时间)。
- Forced
IpEntry
Constants§
Functions§
- broker_
auth_ webtcp_ identity - broker_auth 的 WebTCP-short identity 归一入口。
- default_
webtcp_ identity_ for_ client_ type - C++
WebRequestManager::UpdateCommConfig()的 WebTCP identity 兜底规则: 服务端未下发有效web_tcp_config.web_conn_identity时,moomoo app type 默认CONN_WEB_US,其它(Futu OpenD/Futu HK)默认CONN_WEB_HK。 - empty_
snapshot - 生成一个空 snapshot —— 用于
SharedCommConfig初始化 / fallback。 - fetch_
all - forced_
ip_ for_ attribution - gen_
totp_ sha1 - 生成 6 位 TOTP auth_token。对齐 C++
GenGoogleOTPCode_SHA1(OMBase_API_OTP.cpp:12): - ips_
for_ attribution - 从 snapshot 取某 attribution 对应的 IP 池(去拷贝成
Vec<(String, u16)>)。 如果没有则返回空。调用者可以把返回值 merge 到硬编码池最前面。 - ips_
for_ broker - 从 snapshot 取 broker_id 对应的 broker 专用 IP 池。
- ips_
for_ web_ identity - 从 snapshot 取 WebTCP-short identity 对应的 IP 池。
- is_
web_ identity - 对齐 C++
FTConnCmn.proto的CONN_WEB_*identity。 - spawn_
refresher - 后台循环:按
limit_time周期刷新 CommConfig,把新 snapshot 存到SharedCommConfig。 - webtcp_
addrs_ for_ identity - broker_auth WebTCP-short 的连接候选池:commconfig 优先,空时落到 C++ hardcoded WebTCP 池。调用方不应自己拼 DNS 域名作为主路径。
- webtcp_
hardcoded_ addrs - C++
LoadHardcodeAddress()里 WebTCP-short identity 的本地保底池。
Type Aliases§
- Auth
Guaranteed Domain Map - 解析后的
auth_guaranteed_domain_list—— 原始鉴权域名 → 兜底域名。 - Forced
IpMap - 解析后的
forced_ip_for_conn—— identity → (ip, port, expire_ts)。 - Guaranteed
Broker IpMap - 解析后的 Broker 部分
guaranteed_ip_for_conn—— broker_id → IP 列表。 key 是FTConnCmn.protoConnIdentity里的CONN_BROKER_FUTU_*值 (1001=HK / 1007=US / 1008=SG / 1009=AU / 1012=JP / 1017=MY / 1019=CA)。 - Guaranteed
IpMap - 解析后的 Platform 部分
guaranteed_ip_for_conn—— attribution → IP 列表。 - Guaranteed
WebIp Map - 解析后的 WebTCP-short 部分
guaranteed_ip_for_conn—— web conn_identity → IP 列表。 key 是FTConnCmn.protoCONN_WEB_*的 10100..10107。 - Shared
Comm Config - 一个
ArcSwap缓存槽——Bridge 持有,重连/后台刷新器共享。load()无锁读,store(Arc::new(new))原子替换。