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

MacOSX

$ 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

Windows (32 bit)

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

ARM

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

ARM(aarch64, arm64, v8)

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

Docker Container

$ docker pull expresssocket/socketxp

 


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 login "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 pull expresssocket/socketxp

Create a config.json file in your local directory and map it as a volume inside the container at /data direcotry as shown in the example below.

$ docker run -d  -v /tmp/my_data:/data expresssocket/socketxp

25ad610483f7a324858b79f94de5356c37b3997abc8d105d0eb8ca004c27ec54
$ docker logs 25ad
Using config file: /data/config.json
Login Succeeded.
User [] Email [test-user@gmail.com].

Connected.
Public URL -> https://test-user-gmail-com-33323.socketxp.com

Here is the content of a sample config.json file.

$ cat /tmp/my_data/config.json

{
    "authtoken": "",
    "tunnel_enabled": true,
    "tunnels" : [{
        "destination": "https://172.10.0.1:8123",
        "protocol": "http",
        "custom_domain": ""
    }],
    "relay_enabled": false,
    "relays": [{
    "destination": "https://172.10.0.1:8123"
    }]
}

If you want to configure TLS tunnels then use the below config.json file.

$ cat /tmp/my_data/config.json

{
    "authtoken": "",
    "tunnel_enabled": true,
    "tunnels" : [{
        "destination": "https://172.10.0.1:8123",
        "protocol": "tls",
        "custom_domain": "dev.example.com"
    }],
    "relay_enabled": false,
    "relays": [{
    "destination": "https://172.10.0.1:8123"
    }]
}

Where “172.10.0.1” is the IP address of the other docker container running your web application (Eg; Jenkins server or Home Automation server or nodejs app)

Now you can access your localhost network service using the public URL provided in the above output (https://test-user-gmail-com-33323.socketxp.com).