GithubHelp home page GithubHelp logo

batterii / socket-tunnel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ericbarch/socket-tunnel

0.0 0.0 0.0 32 KB

Tunnel HTTP Connections via socket.io streams.

License: MIT License

JavaScript 92.04% TypeScript 5.80% Dockerfile 2.16%

socket-tunnel's Introduction

socket-tunnel

Tunnel HTTP connections via socket.io streams. Inspired by localtunnel.

Blog Post

Read all about it

Server Usage

  1. Clone this repo and cd into it
  2. docker build -t socket-tunnel .
  3. docker run -d -p 80:3000 --restart=always --name st-server socket-tunnel
  4. Get a domain name (i.e. YOURDOMAIN.com)
  5. Point your domain name's root A record at your server's IP
  6. Point a wildcard (*) A record at your server's IP

Client CLI Usage

  1. Start your http server that you'd like to expose to the public web (in this example we'll assume it's listening on 127.0.0.1:8000)
  2. Clone this repo and cd into it
  3. npm i
  4. node bin/client --server http://YOURDOMAIN.com --subdomain YOURSUBDOMAIN --hostname 127.0.0.1 --port 8000
  5. Browse to http://YOURSUBDOMAIN.YOURDOMAIN.com to see your local service available on the public internet

Client API Usage

Assuming a web server running on 127.0.0.1:8000

  1. Clone this repo into your project
  2. npm i
  3. In your project file, require the socket-tunnel api and call connect():
const socketTunnel = require('./socket-tunnel/lib/api');

socketTunnel.connect('http://YOURDOMAIN.com', 'YOURSUBDOMAIN', '8000')
  .then(console.log)
  .catch(console.log);
  1. Browse to http://YOURSUBDOMAIN.YOURDOMAIN.com to see your local service available on the public internet

Client API Parameters

socketTunnel.connect(remoteServer, desiredSubdomain, localPort, localHostname) returns a promise which resolves to the requested URL/subdomain.

Property Default Description
remoteServer n/a IP address or hostname of the socket-tunnel server
desiredSubdomain n/a Subdomain to request for this client
localPort n/a Local port to tunnel to
localHostname '127.0.0.1' Local host to tunnel to

Credits

Created by Eric Barch. Additional code provided by these generous contributors.

License

This project is licensed under the MIT License - see the LICENSE file for details

socket-tunnel's People

Contributors

ericbarch avatar iperevozchikov avatar zachjmoore 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.