This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Setup

Download the lan2wan agent and extract the tar/zip file.
Optionally you can place the lan2wan executable in your OS binary path.

Login

To get registered user benefits, you should have an account in lan2wan console server.

lan2wan login --email my@email.com --token my_token

Command Usage

lan2wan command utility has built in help documentation. Run lan2wan -h or lan2wan --help to get detailed usage options.

$ lan2wan --help
lan2wan is the agent of lan2wan console server (https://console.lan2wan.in)

Usage:
  lan2wan [command]

Available Commands:
  attach      Attaches your remote tcp port (via url) to the localhost
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  info        Prints configured agent details
  list        List available resources
  login       Authenticate with lan2wan console server and keeps the credentials in the config file.
  logout      Log out from the server, removes the credentials from the config file
  plan        Prints your plan and balance details
  publish     Publishes a lan servers(http, https, file, tcp) into public url
  set         Set a resource value
  start       Starts the lan2wan agent, takes endpoint configuration details from the lan2wan console server
  update      Updates lan2wan agent to the latest version
  version     Prints agent version details
  zone        Prints the current zone

Flags:
  -c, --config string   config file (default is $HOME/.lan2wan/.lan2wan.yaml)
  -h, --help            help for lan2wan
  -o, --output string   output format. options: yaml, json, console (default "console")
      --pretty          JSON pretty print

Use "lan2wan [command] --help" for more information about a command.

Publish your local service

Two options available to publish your services

Publish Temporarily

This option will be useful when you want to publish your services for short time. Useful for developers to publish their application, webhooks, etc.,

Publish http service
# publish http service
$ lan2wan publish http://localhost:8080 --username hello --password my_secret

# publish files
$ lan2wan publish file:///tmp/my_share --username hello --password my_secret
Publish tcp port

Publishing tcp port works via websocket. It means you have to attach to a port on your remote host to access the tcp connection.

# publishes port localhost ssh via websocket
$ lan2wan publish tcp://127.0.0.1:22
Remote URL / HTTP http://random-domain.lan2wan.online
Remote URL / HTTPS https://random-domain.lan2wan.online

# command to attach your published tcp port on a remote host
# your tcp service will be accessible via 35913 port on a remote host
$ lan2wan attach https://random-domain.lan2wan.online
tcp service is listening on: 127.0.0.1:35913

# ssh into the localhost from remote location
$ ssh root@127.0.0.1 -p 35913
root@127.0.0.1's password:

Publish Permanently

Publish permanently is like configure once and forget :)

  • You should your agent configuration in the console server
  • on the command line login with agent name and your agent token from console server (Agents >> Agent Token)
    lan2wan login --email my@email.com --token my_token --agent-name my_agent
    
  • Start the agent
    lan2wan start
    

Thats it! Now you can update your changes on the lan2wan console server. Changes will be published automatically to your agent.

Docker container

You can start your agent as a docker container.

  • create lan2wan.yaml file with your credentials as follows in your localhost,
agent_name: my_agent
email: my@email.com
token: my_token
  • create certs director in your localhost and start lan2wan docker
mkdir -p ./certs

docker run --name lan2wan-agent \
    --env TZ="Asia/Kolkata" \
    --volume ${PWD}/certs:/app/certs \
    --volume ${PWD}/lan2wan.yaml:/app/lan2wan.yaml \
    --restart unless-stopped \
    quay.io/lan2wan/lan2wan:1.3.0