Skip to content

lanbomo/porting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

porting

a port forwarding tool 端口转发工具

by lanbo.

Install

install global

npm install porting -g

install local

npm install porting

Usage

command-line

  1. Use default config file port-config.json

    porting
  2. Use custom config file

    porting -c portings.json
    porting --config portings.json

    config files structure

    [
        {
            "name": "ssh",
            "port": "2222",
            "remoteHost": "192.168.1.101",
            "remotePort": "22"
        },
        {
            "name": "web server",
            "port": "8080",
            "remoteHost": "localhost",
            "remotePort": "80"
        }
    ]
  3. Use command-line argument

    porting 2222/192.168.1.101:22,8080/localhost:80

as a node.js module

const porting = require('porting');

// This will start the servers
const unListen = porting([
    {
        "name": "ssh",
        "port": "2222",
        "remoteHost": "192.168.1.101",
        "remotePort": "22"
    },
    {
        "name": "web server",
        "port": "8080",
        "remoteHost": "localhost",
        "remotePort": "80"
    }
]);

// This will close the servers
unListen();

About

a port forwarding tool 端口转发工具

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published