td icon indicating copy to clipboard operation
td copied to clipboard

fix(faketls): fix encoding SNI in faketls ClientHello

Open markpash opened this issue 1 year ago • 1 comments

Hi, I found a really annoying bug that prevented me from being able to use faketls based mtproto proxies. It took a couple of days to figure out why, but I finally found the problem. Luckily it's a quick fix.

Just FYI, the telegram android and desktop codebases have updated their faketls implementation and I was wondering if you'd be interested in me contributing a follow-up PR with those improvements.

The offset calculation used in the stack code in the ClientHello creation function was incorrect, resulting in the SNI field not being correctly encoded and therefore not being able to connect to faketls mtproto proxies.

Added parenthesis to fix the math.

markpash avatar Jun 27 '24 07:06 markpash

Hi, thank you for contribution! Please update tests so I can merge this.

ernado avatar Jun 30 '24 14:06 ernado

Hi, thank you for contribution! Please update tests so I can merge this.

Hey no problem. I've updated the test.

markpash avatar Jul 03 '24 03:07 markpash

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.10%. Comparing base (1a7623f) to head (736dd57). Report is 31 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1400      +/-   ##
==========================================
+ Coverage   70.99%   71.10%   +0.10%     
==========================================
  Files         442      442              
  Lines       17722    17723       +1     
==========================================
+ Hits        12582    12602      +20     
+ Misses       4203     4191      -12     
+ Partials      937      930       -7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 03 '24 10:07 codecov[bot]