tholian-network / stealth

:rocket: Stealth - Secure, Peer-to-Peer, Private and Automateable Web Browser/Scraper/Proxy
GNU General Public License v3.0
1.04k stars 301 forks source link

Stealth: WS Connection Refactor #72

Closed cookiengineer closed 3 years ago

cookiengineer commented 3 years ago

The WS Connection needs to be refactored and implemented with an external Packet Parser like all the other wireformats and protocols.

cookiengineer commented 3 years ago

The WebSocket Connection state handling needs to be transparent. The major difference from all other network protocols (so far) is the ping/pong/close workflow that WS13 describes.

Currently, the parsing mechanism implements a response property that influences the connection state. This should be decoupled, so that the new WS Packet Parser can be used to analyze a packet before it's being processed - and be integrateable once the WS protocol is being used as an alternative tunneling protocol.

Nevertheless the ondata() callback should be used as a place to do this kind of handling, as the WS.receive() method isn't the right place for it as it can be called by outside mechanisms that are independent of the connection (aka connection being null).

cookiengineer commented 3 years ago

This has been implemented, reviews have been fixed and is up and running as the new binary-embracing protocol.

At a later point in time, there might be support for the gzip frame-by-frame compression that Chromium uses by default (and is limited to ~131kB frame size)