Step 1. Download SocketXP

First, download the SocketXP client, a single binary with zero run-time dependencies.

Linux

$ curl -O https://portal.socketxp.com/download/linux/socketxp && chmod +wx socketxp && sudo mv socketxp /usr/local/bin

Mac OSX

$ curl -O https://portal.socketxp.com/download/darwin/socketxp && chmod +wx socketxp && sudo mv socketxp /usr/local/bin

Windows

https://portal.socketxp.com/download/windows/socketxp.exe

Docker

$ docker pull expresssocket/socketxp

ARM

$ curl -O https://portal.socketxp.com/download/arm/socketxp && chmod +wx socketxp && sudo mv socketxp /usr/local/bin

Step 2. Connect Your Account

Execute the following command to connect the SocketXP client with the SocketXP Cloud Service, using the unique auth-token provided to you in the SocketXP Portal.

$ socketxp -register "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NDk1MTg0MDAsImlkIjoiZ2FuZXNodmVscmFqYW5AZ21ha6K208n0.cB2uYevpH4lWIQGQUJdQ0eiEDqS8OiP_YOiqernnui3rjjadfadsfsfas34"

Visit the SocketXP portal to get your auth token. Don’t have an account ? Sign up for free to receive your auth-token.


Step 3. Create Secure Tunnels

Once you have authenticated the SocketXP client with the SocketXP Cloud Service, you can begin creating secure tunnels to your localhost network services.

Here are some of the network services you could connect using SocketXP secure tunnels.

NGINX

To expose the NGINX server running on your localhost to the internet, use the below command to create a HTTP tunnel to port 80.

$ socketxp -connect http://localhost:80
Service URL -> https://25a3d66c-47ab-41e1-aa56-a2942e33b94e.socketxp.com

SSH

Use the command below to create a TCP tunnel to expose your SSH server to the internet. Port 22 is the TCP port on which your SSH server is listening for connections from any SSH clients.

$ socketxp -connect tcp://localhost:22
Tunnel Access -> tunnel.socketxp.com:3022

Node.js

Use the following command to expose your Node.js web application running on localhost port 5000 to internet.

$ socketxp -connect http://localhost:5000
Service URL -> https://25a3d66c-47ab-41e1-aa56-a2942e33b95f.socketxp.com

Expose Your LAN Services to Internet

You want to expose a network service running in your LAN or Home network to internet, but cannot install SocketXP client in the device ? No worries. Install SocketXP client in your laptop and run the below command to expose the network service to internet.

$ socketxp -connect tcp://192.168.10.7:7000
Tunnel Access -> tunnel.socketxp.com:32719

where 192.168.10.7 is the IP address of the network service running in your LAN network and 7000 is the TCP port on which the network service is listening.

Now you can access your network service using the unique tunnel endpoint (TCP port 32719) created exclusively for the network service.


Step 4. Access Your Network Service

After you have successfully created the HTTP or TCP tunnel, use the public URL provided by SocketXP ( https://25a3d66c-47ab-41e1-aa56-a2942e33b94e.socketxp.com) to access your network service from anywhere in the world.


Run SocketXP Client as a Docker Container

Do you have concerns about running SocketXP binary natively on your laptop or server? No worries. We understand your security concerns. That’s why we have created a Docker container image of our SocketXP client. It’s is available for download in the DockerHub.

Use the following Docker command to download and configure the SocketXP Docker container to expose any network service running in your LAN network to the internet.

$ docker run -d -e TOKEN="eyJhbGciOiJIUzIadsfqwer23ewCJ9.eyJleHAiOjE1NTA3MzgwMjEsImlkIjoiZ2FuZXNodmVscmFqYW5AZ21haWwuY29tIn0.CND1sWy1004q0lAEFadfiasdfupqer13413qsdfqer" -e CONNECT_URL="http://192.168.10.1:9099" expresssocket/socketxp:latest

684157bff487a12797aca426b2e79af94ed4da68fc6474ddd3d8f1bc8a8d53dc

The above command takes two environmental variables as arguments namely, TOKEN and CONNECT_URL.

The IP address specified in the CONNECT_URL, 192.168.10.1, is the IP address of the host machine, and 9099 is the host port on which local application is running either natively or as a Docker container.

$ docker logs 6841
Successfully registered socketxp for user [john] email [john@gmail.com] with service hub using token provided.

Service URL -> https://25a3d66c-47ab-41e1-aa56-a2942e33b94e.socketxp.com

where 6841 is the docker container ID of the SocketXP docker container.

Now you can access your localhost network service using the public URL provided in the above output (https://25a3d66c-47ab-41e1-aa56-a2942e33b94e.socketxp.com).