| Sponsored by ppl | tunnel-server.js | tunnel-client.js |
stunnel.js
A client that works in combination with stunneld.js to allow you to serve http and https from any computer, anywhere through a secure tunnel.
- CLI
- Library
CLI
Installs as stunnel.js
with the alias jstunnel
(for those that regularly use stunnel
but still like commandline completion).
Install
npm install -g 'git+https://git@git.coolaj86.com/coolaj86/tunnel-client.js.git#v1'
Or if you want to bow down to the kings of the centralized dictator-net:
npm install -g stunnel
Usage with OAuth3.org
The OAuth3.org tunnel service is in Beta.
Terms of Service: The Software and Services shall be used for Good, not Evil. Examples of good: education, business, pleasure. Examples of evil: crime, abuse, extortion.
stunnel.js --agree-tos --email john@example.com --locals http:*:4080,https:*:8443 --device
stunnel.js \ --agree-tos --email <EMAIL> \ --locals <List of <SCHEME>:<EXTERNAL_DOMAINNAME>:<INTERNAL_PORT>> \ --device [HOSTNAME] \ --domains [Comma-separated list of domains to attach to device] \ --oauth3-url <Tunnel Service OAuth3 URL>
Advanced Usage (DIY)
How to use stunnel.js
with your own instance of stunneld.js
:
stunnel.js \ --locals <<external domain name>> \ --stunneld wss://<<tunnel domain>>:<<tunnel port>> \ --secret <<128-bit hex key>>
stunnel.js --locals john.example.com --stunneld wss://tunnel.example.com:443 --secret abc123
stunnel.js \ --locals <<protocol>>:<<external domain name>>:<<local port>> \ --stunneld wss://<<tunnel domain>>:<<tunnel port>> \ --secret <<128-bit hex key>>
stunnel.js \ --locals http:john.example.com:3000,https:john.example.com \ --stunneld wss://tunnel.example.com:443 \ --secret abc123
--secret the same secret used by stunneld (used for authentication)
--locals comma separated list of <proto>:<servername>:<port> to which
incoming http and https should be forwarded
--stunneld the domain or ip address at which you are running stunneld.js
-k, --insecure ignore invalid ssl certificates from stunneld
Library
Example
var stunnel = ; stunnel;
- You can get sneaky with
net
and provide acreateConnection
that returns astream.Duplex
.
Token
var tokenData = domains: 'doe.net' 'john.doe.net' 'jane.doe.net' var secret = 'shhhhh';var token = jwt;
net
Let's say you want to handle http requests in-process or decrypt https before passing it to the local http handler.
You'll need to create a pair of streams to connect between the local handler and the tunnel handler.
You could do a little magic like this:
stunnel