Skip to content

Add --connect-to flag that allows to change dial target#905

Merged
mmatczuk merged 12 commits intomainfrom
mmt/connect_to_v2
Sep 12, 2024
Merged

Add --connect-to flag that allows to change dial target#905
mmatczuk merged 12 commits intomainfrom
mmt/connect_to_v2

Conversation

@mmatczuk
Copy link
Contributor

Fixes #315

@mmatczuk mmatczuk requested a review from Choraden as a code owner September 10, 2024 15:14
@Choraden
Copy link
Contributor

Choraden commented Sep 11, 2024

So a HostPort.Validate works differently than HostPortUser.Validate, which embeds HostPort 🤔 .
I guess, that's ok, since HostPortUser is used only in credentials (allows wildcards *).

@Choraden
Copy link
Contributor

How about adding an e2e test?

HTTP client options:
...
    --connect-to <HOST1:PORT1:HOST2:PORT2>,... (env FORWARDER_CONNECT_TO)
        For a request to the given HOST1:PORT1 pair, connect to HOST2:PORT2 instead. This option is suitable to direct
        requests at a specific server, e.g. at a specific cluster node in a cluster of servers. This option is only
        used to establish the network connection and does not work when request is routed using an upstream proxy. It
        does NOT affect the hostname/port that is used for TLS/SSL (e.g. SNI, certificate verification) or for the
        application protocols. HOST1 and PORT1 may be the empty string, meaning any host/port. HOST2 and PORT2 may
        also be the empty string, meaning use the request's original host/port.
Implement the following

"HOST1" and "PORT1" may be the empty string, meaning "any host/port".
"HOST2" and "PORT2" may also be the empty string, meaning "use the request's original host/port".
@mmatczuk
Copy link
Contributor Author

HostPortUser.Validate() now calls HostPort.Validate().
Added e2e test.

@mmatczuk mmatczuk force-pushed the mmt/connect_to_v2 branch 2 times, most recently from fa2a006 to 435401a Compare September 11, 2024 09:59
httpbin-1  | invalid argument "headers,api:errors" for "--log-http" flag: unknown name: apiError: failed to update flags
@mmatczuk mmatczuk merged commit 6cdeac0 into main Sep 12, 2024
@mmatczuk mmatczuk deleted the mmt/connect_to_v2 branch September 12, 2024 10:04
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.

Add --connect-to flag like in curl

2 participants