Giter Site home page Giter Site logo

pangolin's Introduction

中文版

Introduction

Pangolin, as it's name, is a simple reverse proxy that creates a secure tunnel from a public endpoint to a locally running web app.

HTTP/1.1 requests are transmitted to local by HTTP/2 proxy.

Principle

Web browser <-------HTTP/1.1-------> Public endpoint <-------HTTP/2-------> Local server <-------HTTP/1.1-------> Local web app

We can see that the public or other network's browsers can not access the local network application directly. I open a TCP Server by running in the public network, let the network client to connected by socket, and then based on the connection in the network was created, a HTTP/2 Server can be used to forward each http requests.

I created both HTTP/2 server and client based on node-http2 while I make a little change to make it use a specified socket instance to create server and send requests.

I use h2c (HTTP2 cleartext), so the transmit data from public to local are sent in the clear, the data format is binary because of HTTP/2. It is also quite easy to add TSL, but I didn't do it for a convenient testing.

Instructions

Install pangolin on both server and local side.

sudo npm install -g pangolin --verbose

Command line

  • Server
pangolin server -p 10000  #Start to listen,TCP port 10000
  • Local
pangolin client -r <public ip/domain>:<port> -l <port>
or
pangolin client -r <public ip/domain>:<port> -l <local ip/domain>:<port>

Node.js API

  • Server
var pangolin = require('pangolin');
pangolin.createServer({
  port: 10000,        //TCP port
  httpConnects: 9     //Max http connections
});
  • Local
var pangolin = require('pangolin');
pangolin.connect({
  remoteHost : '127.0.0.1',  //Server IP address
  remotePort : 10000,        //Server TCP port
  localHost  : '127.0.0.1',  //Local web app IP address
  localPort  : 8360,         //Local web app port
  showAccessLog : false      //Display logs or not   
});

pangolin's People

Contributors

qgy18 avatar akira-cn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.