MCPcopy Create free account

hub / github.com/F1NDLE/tg_ws_proxy_magisk / functions

Functions110 in github.com/F1NDLE/tg_ws_proxy_magisk

↓ 15 callersMethodget
Take a pre-warmed connection from the pool, if available and fresh. Returns `Some(ws)` on a pool hit, `None` if the bucket is empty or all entries we
rust/pool.rs:75
↓ 15 callersMethodwrite_all
(&mut self, data: &[u8])
rust/proxy.rs:257
↓ 10 callersFunctionmake_cipher
Build an AES-256-CTR cipher from a 32-byte key and 16-byte IV.
rust/crypto.rs:194
↓ 6 callersFunctionbridge_ws
Run a bidirectional re-encrypted bridge between the client (TCP) and Telegram (WebSocket). ```text client → clt_dec → plaintext → tg_enc → sp
rust/proxy.rs:988
↓ 6 callersMethodread
(&mut self, buf: &mut [u8])
rust/proxy.rs:226
↓ 4 callersMethodas_bytes
(&self)
rust/crypto.rs:55
↓ 4 callersFunctionconnect_cf_ws_for_dc
Try all Cloudflare-proxy domains for a DC in order. The hostname serves as both the TCP destination (DNS resolves to Cloudflare's anycast IP, not dir
rust/ws_client.rs:306
↓ 4 callersMethoddrain
(self)
rust/proxy.rs:242
↓ 3 callersFunctionbalanced_cf_domains
Return a rotated view of `cf_domains` based on a global round-robin counter. Each call atomically increments the counter and uses it to determine whi
rust/proxy.rs:113
↓ 3 callersFunctioncf_in_cooldown
(dc: u32, is_media: bool)
rust/proxy.rs:147
↓ 3 callersMethodcf_worker_domain
Cloudflare Worker domain normalized for `Host` and TLS SNI use.
rust/config.rs:438
↓ 3 callersFunctionclear_cf_cooldown
(dc: u32, is_media: bool)
rust/proxy.rs:140
↓ 3 callersFunctionconnect_cf_worker_ws_for_dc
Connect through a Cloudflare Worker TCP tunnel. Unlike `--cf-domain`, the Worker does not expose `kws{N}` subdomains. We connect to the Worker domai
rust/ws_client.rs:409
↓ 3 callersFunctionconnect_ws
Try to establish a WebSocket connection to one Telegram DC domain. Connects TCP to `ip:443`, performs TLS with `domain` as SNI, then does the WebSock
rust/ws_client.rs:84
↓ 3 callersMethoddc_redirects
Map of DC ID → target IP from `--dc-ip` flags.
rust/config.rs:433
↓ 3 callersMethodis_ok
(&self)
rust/check.rs:57
↓ 3 callersMethodlisten_faketls_domain
Inbound FakeTLS domain, either from `--listen-faketls-domain` or from an `ee<key><domainhex>` secret.
rust/config.rs:399
↓ 3 callersFunctionpush_tls_record
(out: &mut Vec<u8>, record_type: u8, payload: &[u8])
rust/faketls.rs:373
↓ 3 callersFunctionread_tls_appdata
Read one TLS Application Data record's payload. Returns `Ok(n)` with the number of payload bytes read into `buf`. Returns `Ok(0)` on EOF or if a non-
rust/faketls.rs:488
↓ 3 callersFunctionset_cf_cooldown
(dc: u32, is_media: bool, cooldown: Duration)
rust/proxy.rs:134
↓ 3 callersFunctionupstream_key
(host: &str, port: u16)
rust/proxy.rs:67
↓ 3 callersFunctionwrite_tls_appdata
Wrap `data` in one or more TLS Application Data records. Each record has the format: `\x17\x03\x03` + 2-byte BE length + payload. Chunks larger than
rust/faketls.rs:458
↓ 2 callersFunctionauto_max_connections
Compute a safe default for the maximum number of concurrent connections given the system FD limit and pool configuration. FD budget: 1 (listener) + p
rust/main.rs:63
↓ 2 callersFunctionbridge_faketls_relay
Bidirectional bridge between the client (TCP) and an upstream FakeTLS proxy. Identical to [`bridge_mtproto_relay`] except that: - **Writes to upstrea
rust/proxy.rs:1373
↓ 2 callersFunctionbridge_mtproto_relay
Bidirectional bridge between the client (TCP) and an upstream MTProto proxy (TCP). The upstream proxy handles the onward Telegram connection. `ciphe
rust/proxy.rs:1270
↓ 2 callersFunctionbridge_tcp
Connect directly to `dst:443` and bridge the re-encrypted streams. Logs a session-close line on return (matching the `bridge_ws` format).
rust/proxy.rs:1476
↓ 2 callersFunctionbuild_faketls_client_hello
Build a TLS 1.2-style ClientHello with the `random` field zeroed. The returned record must be signed with [`sign_faketls_client_hello`] before sendin
rust/faketls.rs:81
↓ 2 callersFunctioncf_worker_in_cooldown
(dc: u32, is_media: bool)
rust/proxy.rs:170
↓ 2 callersFunctionclear_cf_worker_cooldown
(dc: u32, is_media: bool)
rust/proxy.rs:163
↓ 2 callersFunctionclear_upstream_cooldown
(host: &str, port: u16)
rust/proxy.rs:78
↓ 2 callersFunctionconnect_mtproto_upstream
Connect to an upstream MTProto proxy and perform the client handshake. - `0xdd` or plain 16-byte secrets: standard obfuscated TCP. - `0xee` secrets (
rust/proxy.rs:1161
↓ 2 callersFunctionconnect_ws_for_dc
Try all domains for a DC in order; return the first success or the last error. Returns `(Some(stream), all_redirects)`: - `all_redirects = true` when
rust/ws_client.rs:214
↓ 2 callersFunctionconnect_ws_with_path
( ip: &str, domain: &str, path: &str, request_binary_subprotocol: bool, skip_tls_verify: b
rust/ws_client.rs:93
↓ 2 callersFunctiondefault_dc_ips
─── Telegram DC default IPs ───────────────────────────────────────────────── These are the "fallback" addresses used when a DC is not listed in `--dc
rust/config.rs:15
↓ 2 callersFunctiondefault_dc_overrides
DC numbers that are remapped to another DC for WebSocket domain selection. DC 203 (the "test" DC) is treated as DC 2 for websocket connections.
rust/config.rs:31
↓ 2 callersFunctiondeobfuscate
Deobfuscate a single encoded domain. Algorithm (mirrors `_dd()` in the Python reference): 1. Require a `.com` suffix; return `None` if absent. 2. Cou
rust/default_domains.rs:51
↓ 2 callersFunctiondrain_faketls_server_hello
Read and discard TLS records until the fake TLS handshake is complete. FakeTLS proxies send: Handshake (0x16) → ChangeCipherSpec (0x14) → Application
rust/faketls.rs:407
↓ 2 callersFunctionfallback_domains
()
rust/default_domains.rs:139
↓ 2 callersFunctiongenerate_client_handshake
Generate a 64-byte MTProto obfuscation handshake that our proxy sends to an upstream MTProto proxy, plus the two AES-256-CTR ciphers for the session.
rust/crypto.rs:210
↓ 2 callersFunctionparse_domain_list
Parse a plain-text domain list (one domain per line; `#` comments ignored). Each line is deobfuscated before being included.
rust/default_domains.rs:131
↓ 2 callersMethodrefill
(&self, dc: u32, is_media: bool, target_ip: String, skip_tls: bool)
rust/pool.rs:163
↓ 2 callersFunctionset_cf_worker_cooldown
(dc: u32, is_media: bool, cooldown: Duration)
rust/proxy.rs:157
↓ 2 callersFunctionset_upstream_cooldown
(host: &str, port: u16, cooldown: Duration)
rust/proxy.rs:71
↓ 2 callersFunctionsign_faketls_client_hello
Fill the `random` field in a pre-built ClientHello record with the HMAC-SHA256 authentication digest. The digest is computed as: `HMAC-SHA256(secret,
rust/faketls.rs:192
↓ 2 callersMethodsplit
Feed relay-encrypted bytes and receive back a list of complete encrypted MTProto packets, each to be sent as one WebSocket frame. Incomplete packets
rust/splitter.rs:63
↓ 2 callersFunctionupstream_in_cooldown
(host: &str, port: u16)
rust/proxy.rs:86
↓ 1 callersFunctionaccept_inbound_faketls
( label: &str, reader: &mut TcpReader, writer: &mut TcpWriter, secret: &[u8], expected_dom
rust/proxy.rs:265
↓ 1 callersFunctionblacklist_ws
(dc: u32, is_media: bool, cooldown: Duration)
rust/proxy.rs:180
↓ 1 callersFunctionbuild_connection_ciphers
Build the four connection ciphers from the parsed handshake. `prekey_and_iv` is `handshake[8..56]` — the raw (unencrypted) prekey+IV that the client
rust/crypto.rs:310
↓ 1 callersFunctionbuild_default_rustls_config
()
rust/ws_client.rs:495
↓ 1 callersFunctionbuild_faketls_server_hello
(secret: &[u8], hello: &FakeTlsClientHello)
rust/faketls.rs:328
↓ 1 callersFunctionbuild_no_verify_connector
()
rust/ws_client.rs:504
↓ 1 callersFunctionbuild_tls_config
Build a `rustls` `ClientConfig` using the bundled WebPKI root store.
rust/default_domains.rs:74
↓ 1 callersFunctionbuild_tls_connector
(skip_verify: bool)
rust/ws_client.rs:485
↓ 1 callersFunctioncf_worker_path
Path used by the Cloudflare Worker TCP-tunnel mode. The Worker accepts a WebSocket at `/apiws`, opens a raw TCP connection to `dst:443`, and forwards
rust/ws_client.rs:182
↓ 1 callersFunctioncf_ws_domains
WebSocket domains for a given DC when routing through one or more Cloudflare-proxied domains. Each DNS record `kws{N}.{cf_domain}` should be an **ora
rust/ws_client.rs:280
↓ 1 callersFunctionclear_dc_cooldown
(dc: u32, is_media: bool)
rust/proxy.rs:195
↓ 1 callersFunctiondetect_lan_ip
Return the first non-loopback, non-link-local IPv4 address found on the system's network interfaces. Used to generate a usable `tg://` proxy link whe
rust/config.rs:501
↓ 1 callersFunctionfetch_default_domains
Fetch the default CF-proxy domain list from GitHub, deobfuscate it, and return the decoded domains. Falls back to the embedded list on any error.
rust/default_domains.rs:148
↓ 1 callersMethodflush
Flush any remaining buffered bytes as a single chunk.
rust/splitter.rs:113
↓ 1 callersFunctiongenerate_relay_init
Generate a 64-byte obfuscation init packet for the Telegram backend. The relay uses raw (non-secret-hashed) AES-256-CTR keys embedded in the random b
rust/crypto.rs:140
↓ 1 callersFunctionhandle_client
Handle one inbound client connection end-to-end.
rust/proxy.rs:334
↓ 1 callersFunctionhttps_get
Perform a minimal HTTPS GET and return the response body as a `String`.
rust/default_domains.rs:83
↓ 1 callersFunctionis_dns_not_found
Return `true` when `reason` describes a DNS lookup failure. Used in the CF-proxy path to detect when a `kws{N}-1.domain` record is absent so that the
rust/ws_client.rs:196
↓ 1 callersMethodlink_host
The hostname/IP to advertise in the generated `tg://proxy` link. Resolution order: 1. `--link-ip` if explicitly set. 2. Auto-detected first non-loopb
rust/config.rs:468
↓ 1 callersMethodnext_packet_len
Returns the byte length of the next complete packet (header + payload), `None` if there isn't enough data yet, or `Some(0)` for unknown proto.
rust/splitter.rs:130
↓ 1 callersFunctionparse_faketls_client_hello
(record: &[u8], secret: &[u8])
rust/faketls.rs:218
↓ 1 callersFunctionparse_handshake
Try to parse a 64-byte MTProto obfuscation handshake. Returns `None` if the handshake does not decode to a valid protocol tag (wrong secret, corrupt
rust/crypto.rs:83
↓ 1 callersFunctionparse_sni_extension
(mut extensions: &[u8])
rust/faketls.rs:298
↓ 1 callersFunctionprobe_cf_domain
Probe a CF domain by attempting a WebSocket connection to DC 2 through it. DC 2 is used as a representative data-centre — if the domain is correctly
rust/check.rs:69
↓ 1 callersFunctionprobe_cf_worker
Probe a Cloudflare Worker by opening its WebSocket tunnel to DC 2.
rust/check.rs:82
↓ 1 callersFunctionprobe_mtproto_proxy
Probe an MTProto proxy (plain or FakeTLS) by connecting and sending the MTProto obfuscation handshake. For FakeTLS proxies the probe also drains the
rust/check.rs:104
↓ 1 callersFunctionread_inbound_handshake
( label: &str, reader: &mut TcpReader, writer: &mut TcpWriter, secret: &[u8], faketls_doma
rust/proxy.rs:1603
↓ 1 callersFunctionread_tls_record
( reader: &mut R, max_payload_len: usize, )
rust/faketls.rs:380
↓ 1 callersFunctionrun_check
Run the full connectivity check for all configured CF domains and MTProto proxies. Prints a human-readable report to stdout. Returns `true` when eve
rust/check.rs:197
↓ 1 callersMethodsecret_bytes
The proxy secret as raw bytes (decoded from hex).
rust/config.rs:387
↓ 1 callersFunctionset_dc_cooldown
(dc: u32, is_media: bool, cooldown: Duration)
rust/proxy.rs:189
↓ 1 callersFunctionsoft_nofile_limit
Read the soft per-process open-file limit from `/proc/self/limits` (Linux). Falls back to 1 024 on other platforms or when the file cannot be parsed.
rust/main.rs:29
↓ 1 callersFunctionsplit_mtproto_init_and_pending
(data: &[u8])
rust/proxy.rs:1624
↓ 1 callersMethodwarmup
Warm up the pool for all configured DCs on startup.
rust/pool.rs:138
↓ 1 callersFunctionwebpki_roots_store
Build a root certificate store from the bundled WebPKI roots.
rust/ws_client.rs:513
↓ 1 callersFunctionws_domains
WebSocket domains for a given DC. Telegram provides two hostnames per DC; trying both increases resilience. Media DCs prefer the `kwsN-1` variant fir
rust/ws_client.rs:51
↓ 1 callersFunctionws_send
Send a binary WebSocket message and flush.
rust/ws_client.rs:461
↓ 1 callersFunctionws_timeout_for
( dc: u32, is_media: bool, normal_timeout: Duration, fail_probe_timeout: Duration, )
rust/proxy.rs:202
Methodabridged_len
Abridged transport length parsing. - 1-byte header: payload_len = (byte & 0x7F) * 4 - 4-byte header (first byte is 0x7F or 0xFF): payload_len = next_
rust/splitter.rs:146
Methodbuf_bytes
(&self)
rust/config.rs:487
Methodconnect_batch
( ip: &str, dc: u32, is_media: bool, skip_tls: bool, count: usize,
rust/pool.rs:216
Functiondeobfuscate_has_co_uk_suffix
()
rust/default_domains.rs:176
Functiondeobfuscate_known_pair
()
rust/default_domains.rs:208
Functiondeobfuscate_rejects_non_com
()
rust/default_domains.rs:187
Methoddetail
(&self)
rust/check.rs:50
Methoddrop
(&mut self)
rust/pool.rs:56
Methodfrom_args
Parse configuration from CLI arguments.
rust/config.rs:363
Methodfrom_bytes
(b: &[u8])
rust/crypto.rs:46
Functionhuman_bytes
(n: u64)
rust/proxy.rs:1635
Methodintermediate_len
Intermediate / padded-intermediate transport length parsing. 4-byte LE header: payload_len = header & 0x7FFF_FFFF
rust/splitter.rs:175
Methodlink_secret
Full secret value for the generated Telegram link.
rust/config.rs:413
Functionmain
()
rust/main.rs:77
Methodmarker
(&self)
rust/check.rs:43
Methodnew
Create a new splitter that mirrors the relay encryptor state. `relay_init` is the 64-byte obfuscation init sent to Telegram. The splitter builds the
rust/splitter.rs:40
next →1–100 of 110, ranked by callers