qxtunnel
v1.0.1
Published
**QXTunnel** is an end-to-end encrypted tunneling solution that leverages MQTT for secure and managed TCP connections between clients and servers. It facilitates the creation of TCP tunnels through an MQTT broker, enabling seamless and secure communicatio
Downloads
30
Readme
QXTunnel
QXTunnel is an end-to-end encrypted tunneling solution that leverages MQTT for secure and managed TCP connections between clients and servers. It facilitates the creation of TCP tunnels through an MQTT broker, enabling seamless and secure communication across networks.
Features
- Secure Tunneling: Utilizes NaCL for end-to-end encrypted communication.
- Session Management: Handles multiple simultaneous TCP sessions with unique session IDs.
- Easy Configuration: Simple JSON-based configuration for both client and server.
- Cross-Platform: Compatible with major operating systems supporting Node.js.
Installation
Clone the Repository:
git clone https://github.com/yourusername/qxtunnel.git cd qxtunnel
Install Dependencies:
Ensure you have Node.js installed.
npm install
Link the Package:
This allows you to use
qxtunnel
as a global command.npm link
Configuration
Sample Client Configuration (client.config.json
)
{
"port": 3004,
"serverId": "AHnTu0WFqm5prqRWIHTZSwpi2eIGetPUgPhs5sFM2Cs=",
"id": "eDt8LtTN6oPcw6/J4crdJWGujbqduK7RySJNRkiTFwA=",
"sk": "np98MPhpFldRebqGQzrGtAdOAuml7KZrPyq+7fCl89E=",
"heartbeat": 5000,
"mqtt": {
"host": "mqtts://broker.emqx.io:8883",
"options": {}
}
}
Sample Server Configuration (server.config.json
)
{
"port": 22,
"host": "10.0.0.6",
"clientId": "eDt8LtTN6oPcw6/J4crdJWGujbqduK7RySJNRkiTFwA=",
"id": "AHnTu0WFqm5prqRWIHTZSwpi2eIGetPUgPhs5sFM2Cs=",
"sk": "fBsqv9bM3EDUNNIkYFHeJ8Gx534cPhhIrkrDMvgzrn8=",
"heartbeat": 5000,
"mqtt": {
"host": "mqtts://broker.emqx.io:8883",
"options": {}
}
}
Configuration Parameters:
port
: The port number to listen on (client) or to connect to (server).host
: The target host to connect to (server only). Defaults tolocalhost
if not specified.serverId
/clientId
: Unique identifiers for the server and client.id
: Bot identifier.sk
: Secret key for authentication.heartbeat
: Heartbeat interval in milliseconds.mqtt.host
: MQTT broker URL.mqtt.options
: Additional MQTT options.
Usage
Starting the Client
Run the client to start listening for incoming TCP connections and tunnel them through MQTT.
qxtunnel client path/to/client.config.json
Example:
qxtunnel client ./client.config.json
Starting the Server
Run the server to accept tunneled TCP connections and forward them to the specified target host and port.
qxtunnel server path/to/server.config.json
Example:
qxtunnel server ./server.config.json
Create Keys
To establish secure and authenticated communication between the client and server, QXTunnel utilizes a pair of cryptographic keys: an Public Key (id
) and a Secret Key (sk
). These keys ensure that only authorized clients and servers can connect and communicate through the tunnel.
qxtunnel keys
Running as a Service
For production environments, consider running the client and server as background services using tools like pm2
, systemd
, or Docker.