40 lines
2.2 KiB
C
40 lines
2.2 KiB
C
/* Поток записей отделён от внутреннего буфера STCP; все вызовы — в uasync-потоке владельца.
|
|
* CH -> SH + CCS + encrypted(EE/cover Certificate/cover CertificateVerify/Server Finished)
|
|
* -> CCS + encrypted(Client Finished) -> encrypted(STCP handshake и последующий поток).
|
|
* Проверка стороны использует Finished, cover Certificate/CertificateVerify не являются PKI.
|
|
* Root = HKDF-SHA256(AuthKey || X25519(client_ephemeral, server_ephemeral), SHA256(CH || SH),
|
|
* "uTun-reality-record-v2"); в transcript входят handshake-заголовки, но не record-заголовки.
|
|
* От root раздельно выводятся client-traffic/server-traffic и их key/iv/finished-ключи.
|
|
* После собственного SH fallback запрещён. До него relay получает весь исходный буфер без нормализации.
|
|
* Таймеры/списки/кеш replay принадлежат instance; destroy принудительно закрывает I/O без ожидания callbacks. */
|
|
#ifndef REALITY_IO_H
|
|
#define REALITY_IO_H
|
|
#include "reality.h"
|
|
#include "etcp_padding.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
struct stcp_conn;
|
|
struct reality_io;
|
|
struct reality_replay_cache;
|
|
struct reality_relay;
|
|
struct reality_owner {
|
|
struct reality_replay_cache *replay;
|
|
struct reality_relay *relays;
|
|
unsigned relay_count;
|
|
};
|
|
int reality_io_client_start(struct stcp_conn *c, const struct reality_client_config *cfg, uint32_t now,
|
|
const struct ETCP_PADDING *padding, void (*ready)(struct stcp_conn *));
|
|
int reality_io_server_start(struct stcp_conn *c, void (*ready)(struct stcp_conn *));
|
|
size_t reality_io_buffered(const struct stcp_conn *c);
|
|
int reality_io_read(struct stcp_conn *c);
|
|
void reality_io_resume(struct stcp_conn *c);
|
|
int reality_io_send(struct stcp_conn *c, uint8_t *data, size_t len);
|
|
int reality_io_close_notify(struct stcp_conn *c);
|
|
void reality_io_cleanup(struct stcp_conn *c);
|
|
void reality_owner_cleanup(struct reality_owner *owner);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|