Search…
CLI
LocalXpose Command Line Interface

Usage

loclx <COMMAND> <SUBCOMMAND> <FLAG>

Commands

- account

This command is responsible for user account related functions.

Sub-commands:

  • login
    To get the pro plan benefits the user should login with his access token which can be found in user dashboard from the website.
  • status
    To check the user login and subscription status.

Examples:

#login
loclx account login
#status
loclx account status

- tunnel

Tunnel command is responsible for tunneling functions, you can start HTTP, TLS, TCP, UDP tunnels

Flags:

Flag
Value
Required
Description
--raw-mode
false
no
raw mode will disable terminal UI, it is mostly used in background process and legacy systems

Sub-commands:

  • config
    Start multiple tunnels from config yaml file, and it has subcommand too called `init` to create a smaple config file in the current working directory.
Flag
Value
Required
Description
--path
/path/to/config.yml
yes
Config file which has list of tunnels to start at once

config.yaml example:

dev:
type: http
region: us
to: localhost:9090
ssh:
type: tcp
region: us
port: 7676
to: localhost:22
plugins:
ip_whitelist:
- 127.0.0.1
portal:
type: http
subdomain: hello
region: us
to: localhost:8080
plugins:
basic_auth: user:pass
ip_whitelist:
- 127.0.0.1
- 192.168.100.21/24
chat:
type: tls
subdomain: secure
region: us
to: localhost:2090
work:
type: http
region: us
to: localhost:9090
plugins:
request_header:
- host:mydomain.com
- X-Token:secureToken
response_header:
- role:admin
file-server:
type: http
region: us
reserved_domain: mydomain.com
apps:
file_server:
path: ./
  • http
    Start http/https tunnel
Flag
Value
Required
Description
--to
127.0.0.1:8821
or :8821
Yes
To which address forward the traffic
default: 127.0.0.1:8080
--region
eu
Yes
On which region to start a tunnel
default: us
--subdomain
myapp
No
The tunnel subdomain
--reserved-domain
example.com
No
The tunnel url
--request-header
Host:myapp.localhost.io
No
Add or remove any request header before reaching your localhost service
--response-header
Role:Admin
Add or remove any response header before sending it back to the client.
--ip-whitelist
192.168.100.10 or 72.12.10.0/24
No
IP address(es) allowed to access your localhost service
--rate-limit
20
No
Limit the amount of requests to your backend (e.g. 20 for 20 requests/sec)
--key-auth
SECURE_TOKEN
NO
Protect the tunnel with key authentication passed in X-Token header (e.g. veryStrongToken)
--basic-auth
user:pass
No
Protect the tunnel with basic auth
--file-server
/home/shared
No
Start a file server on specific path
--crt
/path/to/crt.pem
No
pass your own TLS certificate
--key
/path/to/key.pme
No
pass your own TLS key
--https-to
localhost:443
No
Disable TLS termination and pass the TLS traffic to
  • tls
    Start TLS tunnels
Flag
Value
Required
Description
--to
127.0.0.1:8821
or :8821
Yes
To which address forward the TLS traffic
default: 127.0.0.1:8080
--region
eu
Yes
On which region to start a tunnel
default: us
--subdomain
myapp
No
The tunnel subdomain
--reserved-domain
example.com
No
The tunnel URL
--crt
/path/to/crt.pem
No
Path to your own TLS certificate for TLS termination
--key
/path/to/key.pem
No
Path to your own TLS key for TLS termination
  • tcp
    TCP tunnel let you expose services which runs over TCP
Flag
Value
Required
Description
--to
127.0.0.1:8821
or :8821
Yes
To which address forward the traffic
default: 127.0.0.1:8080
--region
eu
Yes
On which region to start a tunnel
default: us
--reserved-endpoint
us-1.loclx.io:4454
No
The tunnel endpoint
  • udp
    UDP tunnel let you expose services which runs over UDP
Flag
Value
Required
Description
--to
127.0.0.1:8821
or :8821
Yes
To which address forward the traffic
default: 127.0.0.1:8080
--region
eu
Yes
On which region to start a tunnel
default: us
--reserved-endpoint
us-1.loclx.io:4454
No
The tunnel endpoint
  • list
    List all the currently running tunnels by this localxpose instance.
  • stop
    Select which tunnel you want to stop.

Examples:

loclx tunnel list
loclx tunnel stop
loclx tunnel http
loclx tunnel http --subdomain hello --region ap
loclx tunnel http --to localhost:9090 --reserved-domain mydomain.com
loclx tunnel http --baisc-auth user:pass
loclx tunnel http --ip-whitelist 192.168.100.3 --ip-whitelist 10.20.100.10/24
loclx tunnel http --request-header x-token:verySecureToken --request-header role:internal
loclx tunnel http --response-header role:admin --request-header host:admin.corp
loclx tunnel http --file-server /path/to/protected/files --key-auth verySecureToken
loclx tunnel tls
loclx tunnel tls --subdomain tls
loclx tunnel tls --subdomain tls --to 443
loclx tunnel tls --to localhost:443 --reserved-domain mydomain.com
loclx tunnel tls --to localhost:8080 --crt /path/to/crt.pem --key /path/to/key.pem
loclx tunnel tcp
loclx tunnel tcp --port 9999
loclx tunnel tcp --to localhost:22 --reserved-endpoint us.loclx.io:2121
loclx tunnel tcp --region eu --ip-whitelist 192.168.120.2
loclx tunnel udp
loclx tunnel udp --port 19132
loclx tunnel udp --to localhost:19132 --reserved-endpoint us.loclx.io:19132
loclx tunnel udp --region ap --ip-whitelist 192.168.120.2

- domain

Domain command is responsible for managing your domain reservations.

Sub-commands:

  • reserve
    Reserve a subdomain like myapp.loclx.io or custom domain example.com.
Flag
Value
Required
Description
--subdomain
hello-world
Yes
Subdomain to reserve
--domain
example.com
Yes
Custom domain to reserve
--region
ap
Yes
On which region to start a tunnel
default: us
One of the two flags --subdomain or --domain is required but not both.
  • letsencrypt
    Let's encrypt command is responsible for creating let's encrypt certificates for you custom domains.
Flag
Value
Required
Description
--domain
example.com
Yes
Custom domain to create a certificate for
Please make sure of the following rules: 1. There is no a running tunnel using the domain which you want to issue a certificate for. 2. The port 54538 is free.
  • status
    Verify your DNS cname record.
Flag
Value
Required
Description
--domain
example.com
Yes
Domain to check its cname record
  • list
    List all the reserved domains.
  • delete
    Delete a reserved domain.
  • clear
    Delete all the reserved domains.

Examples:

loclx domain list
loclx domain delete
loclx domain clear
loclx domain status --reserved-domain example.com
loclx domain reserve --subdomain hello-world
loclx domain reserve --domain example.com --region eu
loclx domain letsencrypt --domain example.com

- endpoint

Endpoint command is responsible for managing your endpoints reservations.

Sub-commands:

  • reserve
    Reserve an endpoint like us-1.loclx.io:4848.
Flag
Value
Required
Description
--region
ap
Yes
On which region to start a tunnel
default: us
--port
4848
Yes
Custom domain to reserve
default: Random Port
  • list
    List all the reserved endpoints.
  • delete
    Delete a reserved endpoints.
  • clear
    Delete all the reserved endpoints.

Examples:

loclx endpoint list
loclx endpoint delete
loclx endpoint clear
loclx endpoint reserve
loclx endpoint reserve --port 4848
loclx endpoint reserve --region ap
loclx endpoint reserve --port 4848 --region ap

- update

Update to the latest LocalXpose version.

Examples:

loclx update