Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proxy protocol support #352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

shshekhar93
Copy link

Adding support for Proxy Protocol V1.

The changes are limited to the server side, which generates and sends the Proxy Protocol header on data channel. The downstream server must be capable of parsing / handling the proxy protocol header.

Alternatively, an additional proxy protocol unwrapping server (for eg. go-mmproxy) could be setup on the client side. In this setup, rathole client's local_addr would point to the go-mmproxy, and go-mmproxy would in turn point to the actual downstream server.

Change log:

  • Added a new boolean field (enable_proxy_protocol) to ServerServiceConfig.
  • Added logic to generate the Proxy Protocol v1 header from TCP Stream.
  • If the enable_proxy_protocol is set as true, the proxy protocol header is written to data channel and flushed, before remainder of downstream protocol specific communication begins.
  • Example for enabling proxy protocol for a service.

Future enhancements:

  • Support Proxy Protocol v2.
  • Perhaps include the go-mmproxy style source IP spoofing logic on the client side to eliminate the needs for special setup on downstream server / go-mmproxy.

@shshekhar93
Copy link
Author

shshekhar93 commented Apr 10, 2024

Fixed lint error.

@rapiz1
Copy link
Owner

rapiz1 commented Apr 11, 2024

This is interesting

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.

None yet

2 participants