Add support for reserved TCP addresses (#31)

* Add support for reserved tcp addresses
* Rework to suit pull request comments
This commit is contained in:
Matthew Baggett 2019-01-11 09:02:09 +00:00 committed by Werner Beroux
parent 9a8505d39c
commit 6d417fb4de
2 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ Additionally, you can specify one of several environment variable (via `-e`) to
* `NGROK_AUTH` - Authentication key for your Ngrok account. This is needed for custom subdomains, custom domains, and HTTP authentication. * `NGROK_AUTH` - Authentication key for your Ngrok account. This is needed for custom subdomains, custom domains, and HTTP authentication.
* `NGROK_SUBDOMAIN` - Name of the custom subdomain to use for your tunnel. You must also provide the authentication token. * `NGROK_SUBDOMAIN` - Name of the custom subdomain to use for your tunnel. You must also provide the authentication token.
* `NGROK_HOSTNAME` - Paying Ngrok customers can specify a custom domain. Only one subdomain or domain can be specified, with the domain taking priority. * `NGROK_HOSTNAME` - Paying Ngrok customers can specify a custom domain. Only one subdomain or domain can be specified, with the domain taking priority.
* `NGROK_REMOTE_ADDR` - Name of the reserved TCP address to use for a TCP tunnel. You must also provide the authentication token.
* `NGROK_USERNAME` - Username to use for HTTP authentication on the tunnel. You must also specify an authentication token. * `NGROK_USERNAME` - Username to use for HTTP authentication on the tunnel. You must also specify an authentication token.
* `NGROK_PASSWORD` - Password to use for HTTP authentication on the tunnel. You must also specify an authentication token. * `NGROK_PASSWORD` - Password to use for HTTP authentication on the tunnel. You must also specify an authentication token.
* `NGROK_PROTOCOL` - Can either be `HTTP` or `TCP`, and it defaults to `HTTP` if not specified. If set to `TCP`, Ngrok will allocate a port instead of a subdomain and proxy TCP requests directly to your application. * `NGROK_PROTOCOL` - Can either be `HTTP` or `TCP`, and it defaults to `HTTP` if not specified. If set to `TCP`, Ngrok will allocate a port instead of a subdomain and proxy TCP requests directly to your application.

View File

@ -48,6 +48,15 @@ elif [ -n "$NGROK_HOSTNAME" ] || [ -n "$NGROK_SUBDOMAIN" ]; then
fi fi
fi fi
# Set the remote-addr if specified
if [ -n "$NGROK_REMOTE_ADDR" ]; then
if [ -z "$NGROK_AUTH" ]; then
echo "You must specify an authentication token after registering at https://ngrok.com to use reserved ip addresses."
exit 1
fi
ARGS="$ARGS -remote-addr=$NGROK_REMOTE_ADDR "
fi
# Set a custom region # Set a custom region
if [ -n "$NGROK_REGION" ]; then if [ -n "$NGROK_REGION" ]; then
ARGS="$ARGS -region=$NGROK_REGION " ARGS="$ARGS -region=$NGROK_REGION "