Skip to main content

No project description provided

Project description

中文

ProxyNT is a reverse proxy server that can expose a local server to the internet through NATs and firewalls

Principle

原理

Features

  • Easily manage port forwarding from anywhere via a browser
  • Uses WebSocket encryption for secure communication between the public server and local client
  • Easy to install with pip.
  • Stable, automatically reconnects, and has been used in production environments

Common Use Cases

  1. Host web servers from home
  2. Manage IoT devices

Installation

pip install proxynt

Usage

Client

nt_client --help
# start client
nt_client -c config_c.json

Server

# view help
nt_server --help
# start server
nt_server -c config_s.json

After starting the server, open the management page in a browser:

The management page URL is the WebSocket path + /admin,
for example:
http://192.168.9.224:18888/websocket_path/admin

ui

Example: Accessing an Internal Network Machine via SSH

Suppose the public server's IP is 192.168.9.224.

1. Configure config_s.json on the public server

{
  "port": 18888,
  "password": "helloworld",
  "path": "/websocket_path",
  "admin": {
    "enable": true,  
    "admin_password": "new_password"  
  }
}

Explanation:

  • port: listening port
  • password: connection password
  • path: WebSocket path
  • admin: management page configuration (not required)
  • admin.enable: whether to enable the management page
  • admin.admin_password: management password

Then start the server with:

nt_server -c config_s.json

2. Configure config_c.json on the machine to be accessed

{
  "server": {
    "port": 18888,
    "host": "192.168.9.224",
    "https": false,
    "password": "helloworld",
    "path": "/websocket_path"
  },
  "client_name": "home_pc",
  "client": [
    {
      "name": "ssh1",
      "remote_port": 12222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    }
  ]
}

Explanation:

  • server: configuration for the server to connect to, including port, IP address, whether to use HTTPS, password, and WebSocket path.
  • client_name: name of the client, which must be unique.
  • client: list of port forwarding configurations, mapping port 22 on the local machine to port 12222 on the server in this example.

Then start the client with:

nt_client -c config_c.json

3. SSH connection

ssh -oPort=12222 test@192.168.9.224

Open the management page

http://192.168.9.224:18888/websocketpath/admin

Full Configuration Description (please delete the comments when using)

  • Client config_c.json
{
  "server": {  // Server configuration to connect to
    "port": 18888,  // Port
    "host": "192.168.9.224",  // IP address
    "https": false,  // Whether the server is using HTTPS
    "password": "helloworld",  // Password
    "path": "/websocket_path"  // WebSocket path
  },
  "client": [  // List of forwarding configurations
    {
      "name": "ssh",
      "remote_port": 1222,
      "local_port": 22,
      "local_ip": "127.0.0.1"
    },
    {
      "name": "mongo",
      "remote_port": 1223,
      "local_port": 27017,
      "local_ip": "127.0.0.1"
    }
  ],
  "client_name": "ubuntu1",  // Client name, must be unique
  "log_file": "/var/log/nt/nt.log"  // Path to log file
}
  • Server config_c.json
{
    "port": 18888,  // Listening port
    "password": "helloworld",  // Password
    "path": "/websocket_path",  // WebSocket path
    "log_file": "/var/log/nt/nt.log",  // Path to log file
    "admin": {  
        "enable": true,  // Whether to enable admin page
        "admin_password": "new_password"  // Password for admin page
    }
}

Update history

  • 1.1.7: Fixed duplicate client_name
  • 1.1.6: Fixed client WebSocketException: socket is already opened.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxynt-1.1.8.tar.gz (340.3 kB view hashes)

Uploaded Source

Built Distribution

proxynt-1.1.8-py3-none-any.whl (366.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page