Protect REALITY STCP traffic with authenticated TLS-like records
This commit is contained in:
1 parent
a49cf5434e
commit
a069d11ef9
33 files changed
+1786
-421
No files matched your search
@@ -73,13 +73,17 @@ const struct TOPO_REALITY_SOCK* topo_node_find_reality_sock(const struct TOPO_NO
|
||||
}
|
||||
|
||||
/* Копирует reality-параметры узла в link->reality и поднимает флаг reality_set. */
|
||||
void topo_node_reality_config(struct reality_client_config *cfg, const struct TOPO_REALITY_SOCK *rs) {
|
||||
memcpy(cfg->server_static_pubkey, rs->server_pubkey, REALITY_AUTH_KEY_SIZE);
|
||||
memcpy(cfg->short_id, rs->short_id, REALITY_SHORT_ID_SIZE);
|
||||
memcpy(cfg->version, rs->version, REALITY_VERSION_SIZE);
|
||||
snprintf(cfg->server_name, sizeof(cfg->server_name), "%s", rs->server_name);
|
||||
cfg->fingerprint = REALITY_FP_OPENSSL;
|
||||
}
|
||||
|
||||
void topo_node_apply_reality(struct ETCP_LINK* link, const struct TOPO_REALITY_SOCK* rs) {
|
||||
if (!link || !rs) return;
|
||||
memcpy(link->reality.server_static_pubkey, rs->server_pubkey, REALITY_AUTH_KEY_SIZE);
|
||||
memcpy(link->reality.short_id, rs->short_id, REALITY_SHORT_ID_SIZE);
|
||||
memcpy(link->reality.version, rs->version, REALITY_VERSION_SIZE);
|
||||
snprintf(link->reality.server_name, sizeof(link->reality.server_name), "%s", rs->server_name);
|
||||
link->reality.fingerprint = REALITY_FP_CHROME;
|
||||
topo_node_reality_config(&link->reality, rs);
|
||||
link->reality_set = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user