CLI

LocalXpose Command Line Interface

Usage

# *nix systems
loclx <COMMAND> <SUBCOMMAND> <FLAG>
 
# windows
loclx.exe <COMMAND> <SUBCOMMAND> <FLAG>

Available Commands

account

This command is responsible for user account related functions.

loclx account -h
NAME:
   LocalXpose account - account authentication and status
 
USAGE:
   LocalXpose account command [command options]
 
COMMANDS:
   login    login using your access token
   status   check account status
   help, h  Shows a list of commands or help for one command
 
OPTIONS:
   --help, -h  show help (default: false)
 

User can grab his access token from the dashboard here https://localxpose.io/dashboard/access (opens in a new tab). An alternative way to login without issuing account login is by passing the ACCESS_TOKEN as environment variable for example:

# *nix systems
export ACCESS_TOKEN=your_access_token
 
# windows
set ACCESS_TOKEN=your_access_token
 
# then start your authenitcated requests normally
loclx tunnel http

Using account login will store the access token securely in your OS keyring store and fallback to a file in $HOME/.access.

tunnel

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

loclx tunnel -h
NAME:
   LocalXpose tunnel - create (HTTP,TLS,TCP,UDP) tunnel
 
USAGE:
   LocalXpose tunnel command [command options]
 
COMMANDS:
   config, c  run tunnels from config yaml file
   http, H    create http tunnel
   tls, T     create tls tunnel
   tcp, t     create tcp tunnel
   udp, u     create udp tunnel
   list, l    list all the running tunnels
   stop, s    stop tunnel
   help, h    Shows a list of commands or help for one command
 
OPTIONS:
   -r, --raw-mode  run the tunnels in a raw mode (default: false)
   --help, -h      show help (default: false)

The flag --raw-mode will disable terminal UI, it is mostly used in background process and legacy systems like windows 7.

- Run http tunnel

loclx tunnel http

You can check more about HTTP tunnel here.

- Multiple tunnels from config file

loclx tunnel config -f /path/to/config.yaml

Read more about the config file syntax here.

- Tunnel with specific region and temporary subdomain

loclx tunnel http --subdomain hello --region ap

- Run http tunnel with plugins:

loclx tunnel http --basic-auth user:pass --request-header role:internal

- Run tcp tunnel with a temporary port:

loclx tunnel tcp --region eu --port 9999

domain

Domain command is responsible for managing your domain reservations.

loclx domain -h
NAME:
   LocalXpose domain - manage your domain reservations
 
USAGE:
   LocalXpose domain command [command options]
 
COMMANDS:
   reserve, r      reserve a subdomain or custom domain
   list, l         list all the reserved domains
   status, s       verify your dns cname record
   delete, d       delete a reserved domains
   clear, c        delete all the reserved domains
   letsencrypt, L  create Lets Encrypt TLS certificate for your domain
   help, h         Shows a list of commands or help for one command
 
OPTIONS:
   --help, -h  show help (default: false)

- Reserve a subdomain

loclx domain reserve --subdomain hello

A subdomain hello.loclx.io will be reserved in the region us so then you can use it in your tunnels like loclx tunnel http --reserved-domain hello.loclx.io

- Reserve a custom domain

loclx domaion reserve --domain "example.com"

Then you can use it in your tunnels like loclx tunnel http --reserved-domain example.com, more about domain reservation here.

One of the two flags --subdomain or --domain is required but not both.

endpoint

Endpoint command is responsible for managing your endpoints reservations.

loclx endpoint -h
NAME:
   LocalXpose endpoint - manage your endpoint reservations
 
USAGE:
   LocalXpose endpoint command [command options]
 
COMMANDS:
   reserve, r  reserve an endpoint
   list, l     list all the reserved endpoints
   delete, d   delete a reserved endpoint
   clear       delete all the reserved endpoints
   help, h     Shows a list of commands or help for one command
 
OPTIONS:
   --help, -h  show help (default: false)

- Reserve a port in EU region

loclx endpoint reserve --port 7788 --region eu

This will reserve an endpoint eu.loclx.io:7788 that you can use in your tunnels like loclx tunnel tcp --reserved-endpoint eu.loclx.io:7788. You can read more about endpoint reservations here.

Ports allowed are from 1024 to 65535

service

Service will be managing your LocalXpose background daemon service, so you can install, run, stop, restart and uninstall the service in your operating system.

loclx service -h
NAME:
   LocalXpose service - manage localxpose background service
 
USAGE:
   LocalXpose service command [command options]
 
COMMANDS:
   install, i    install localxpose as a background service
   uninstall, u  uninstall localxpose background service
   start, s      start localxpose background service
   stop, p       stop localxpose background service
   restart, r    restart localxpose background service
   status, t     check localxpose background service status
   help, h       Shows a list of commands or help for one command
 
OPTIONS:
   --help, -h  show help (default: false)

- Install the service in your operating system

loclx service install --config /path/to/config.yaml

So this will generate a service in your operating system called localxpose.

- Start the service

loclx service start

This will start the tunnels configured in your config.yaml that we used earlier in the service installation step.

Whenever you need to change some tunnels settings, just stop the service loclx service stop and then modify the config.yaml and then start the service again loclx service start.

setting

Settings managment like http-proxy

loclx setting -h
NAME:
   LocalXpose setting - manage your settings
 
USAGE:
   LocalXpose setting command [command options]
 
COMMANDS:
   proxy, p  setup http proxy
   list, l   list all current settings

- Add http-proxy for your tunnels

If your environment has proxy server to access the internet, then you need to tell LocalXpose:

loclx setting proxy --set http://USERNAME:PASSWORD@proxy-server.mycorp.com:3128

- Remove http-proxy from your settings

loclx setting proxy --unset

update

Update to the latest LocalXpose version.

loclx update

© xLab 2023. All Rights Reserved