cmd/tailcat: add forward subcommand - #62
Open
Audi-dask wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change do?
Add a
tailcat forwardsubcommand for exposing TCP ports served by aTailcat server as ordinary local TCP listeners.
This is useful for browsers, database clients, IDEs, and other
applications that only support regular
host:portconnections and donot provide Tailcat, SOCKS, or stdio proxy integration.
The
<addrblob>argument is the address blob printed bytailcat serve,typically a value beginning with
tc.Related to #14.
Examples
Start a Tailcat server:
tailcat serve 8080 # Server listening with new address: tcXXXXXXXXXForward the served port to the same local port:
This forwards:
Use a different local port:
Forward multiple ports:
tailcat serve 3306,6379 # Server listening with new address: tcXXXXXXXXX tailcat forward tcXXXXXXXXX 3306:3306 6379:6379Bind the local listener to a specific address:
Use
--bind=0.0.0.0only when intentionally allowing connectionsfrom other network interfaces:
Design
Client.DialTCPPortAPI.ProxyConnshelper.<remote>and<local>:<remote>mappings.127.0.0.1by default.--bind.Testing
forwardsubcommand.STUN, and Tailcat server test environment.
connections instead of parsing diagnostic logs.
Tested with:
GOMAXPROCS=2 go test ./...