Skip to content

Conversation

@max-b
Copy link
Contributor

@max-b max-b commented Feb 20, 2025

This essentially takes all of the variables that were previously "package level" and moves them inside of a PseudoTCP struct. Correspondingly, it takes all of the "package level" functions and makes them methods of the PseudoTCP struct.

This facilitates simpler creation, configuration, initialization as well as allows multiple instances of the PseudoTCP struct to be instantiated in parallel if necessary.

I'm opening this as a draft for now because I'd like feedback on this strategy, but I'd also like to refactor the connectToProxy method so that it could be a caller/instantiator provided config. That would do a number of things:

  1. Allow the caller to provide their own options to the masque proxy
  2. Allow the caller to choose between an http2 vs http3 masque proxy
  3. Allow tests to mock that function which could allow for more granular unit-style testing

This essentially takes all of the variables that were previously
"package level" and moves them inside of a PseudoTCP struct.
Correspondingly, it takes all of the "package level" functions and makes
them methods of the PseudoTCP struct. This facilitates simpler
creation, configuration, initialization as well as allows multiple
instances of the PseudoTCP struct to be instantiated in parallel if
necessary.
@max-b max-b requested a review from invisv-team February 20, 2025 21:56
@max-b max-b self-assigned this Feb 20, 2025
This moves from a hard coded ConnectToProxy method to a user
configurable proxyClient interface which allows for:
- The caller to provide their own options to the masque proxy
- The caller to choose between an http2 or http3 (or any other TCP+UDP
  proxy)
- Future tests which can mock the proxyClient allowing for more granular
  unit-style testing
@max-b max-b marked this pull request as ready for review February 24, 2025 22:07
@max-b max-b merged commit 4946910 into main Feb 25, 2025
2 checks passed
@max-b max-b deleted the maxb/refactor branch February 25, 2025 19:16
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.

3 participants