Skip to content

fix: reqTimeout misuse in MakeRequest + hk_lm level MTProxy ClientHello obfuscation#308

Open
joyccn wants to merge 1 commit into
AmarnathCJD:masterfrom
joyccn:fix/timeout-mtproxy-obf
Open

fix: reqTimeout misuse in MakeRequest + hk_lm level MTProxy ClientHello obfuscation#308
joyccn wants to merge 1 commit into
AmarnathCJD:masterfrom
joyccn:fix/timeout-mtproxy-obf

Conversation

@joyccn

@joyccn joyccn commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Context Timeout RPC Fixes

  1. MakeRequest timeout fixMakeRequest was using connConfig.Timeout (TCP connect timeout) instead of reqTimeout (request timeout). Now consistently uses reqTimeout.

  2. Auto-retry after reconnect — 5 consecutive timeouts within 60s trigger a reconnect, then the request is automatically retried on the new connection (depth-limited, instead of returning an error).

hk_lm Level Obfuscation for MTProxy ClientHello

Major improvements to the fake TLS ClientHello to make it harder to fingerprint:

Before After
Fixed 517 bytes Variable length (100-400 random padding)
X25519 only X25519 + P-256 key shares
7 grease values 10 grease values
~10 extensions 17 extensions

New extensions: Application Settings (h2), Compress Certificate, PSK Key Exchange Modes, Signature Algorithms, Status Request, Signed Certificate Timestamps, Grease extensions at realistic positions.

Record layer now uses proper calculated length fields instead of hardcoded values.

Verification

  • go build ./... — OK
  • go vet ./... — OK
  • go test ./internal/transport/ — 14/14 PASS (unit tests for ParseMTProxySecret, generateFakeTlsHello, HMAC verification, multiple key shares, structure validation)

- MakeRequest now uses m.reqTimeout instead of m.connConfig.Timeout
- Auto-retry requests after reconnect triggered by 5 consecutive timeouts

feat: hk_lm level obfuscation for MTProxy ClientHello

- Variable-length ClientHello (100-400 byte random padding)
- Multiple key shares: X25519 + P-256 (matches modern browsers)
- 10 grease values in realistic positions (up from 7)
- Additional extensions: Application Settings (h2), Compress Certificate,
  PSK modes, Signature Algorithms, Status Request, SCTs
- Proper TLS record framing with correct length fields
@AmarnathCJD

Copy link
Copy Markdown
Owner

@joyccn @ask translate

@joyccn

joyccn commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@joyccn @ask translate
my bad, I forgot to translate to english :'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants