Skip to content

v1.1.4

Choose a tag to compare

@github-actions github-actions released this 14 Apr 21:29
239d11c

Implement FakeTLS (0xee) upstream proxy support + fix README secret format docs

FakeTLS protocol (src/faketls.rs)

New module implementing the client side of the FakeTLS handshake:

  • build_faketls_client_hello(hostname) — TLS 1.2 ClientHello with SNI
  • sign_faketls_client_hello(record, key) — fills random field with HMAC-SHA256 auth: random[0..28] = HMAC(key, record_with_random_zeroed)[0..28], random[28..32] = HMAC[28..32] XOR timestamp_le
  • drain_faketls_server_hello(reader) — discards ServerHello → CCS → first AppData
  • write_tls_appdata() / read_tls_appdata() — TLS record framing (\x17\x03\x03 + 2B BE len)

Upstream connection dispatch (src/proxy.rs)

  • Secret parsing: 0xee → FakeTLS (key = secret[1..17], hostname = secret[17..]); 0xdd → padded-intermediate; bare 16-byte → plain
  • UpstreamConnection enum (Plain | FakeTls) selects bridge at call sites
  • bridge_faketls_relay() — bidirectional bridge identical to bridge_mtproto_relay but wraps/unwraps TLS AppData records around the AES-CTR re-encryption
  • The 64-byte MTProto init is sent inside the first AppData record, after the fake TLS handshake completes