#286

Move most of gvproxy code to a reusable go package with an API

Opencfergeauopened 3y ago

gvproxy code:

  1. register/parses command line arguments
  2. creates a types.Configuration instance from these args
  3. creates some listeners/http muxers from these args + associated go routines

All of this is done in 2 big functions. The crc daemon does 2) and 3) but with slight variations, and without sharing any code from gvproxy. Following https://github.com/containers/gvisor-tap-vsock/pull/280 , it might be useful to podman as well to have an easy way to reimplement their own gvproxy + 9p binary.

What I aim to do is to move 2) and 3) to their own go package (maybe pkg/usernet) which can be used by both gvproxy and the crc daemon. Adding an API for 2) is mostly done, 3) is still being investigated.

Activity

3
cfergeau3y ago

Future improvements could be to move the code in podman detecting whether port 2222 is used or not, and using a different one to this shared code (see https://github.com/containers/podman/issues/20327 and https://github.com/crc-org/crc/issues/3855 )

cfergeau2y ago

Did some work on this in https://github.com/cfergeau/gvisor-tap-vsock/tree/refactor, which adds an api for "2. creates a types.Configuration instance from these args". This needs to be rebased though.