@digitize/with-outline
v1.1.0
Published
This package exports the only function - `withOutline`. When invoked with a callback function passed as an argument, it connects to Outline VPN, invokes the callback as async function and then disconnects from Outline VPN.
Downloads
9
Readme
with-outline
Rationale
This tool has been created to resolve one very specific problem: occasionally connect to Outline VPNto be able to access resources behind it from Amazon or other Cloud providers from NodeJS application running on Ubuntu server.
N.B. Tested only with Ubuntu. Might not work for you. Feel free to raise an issues and contribute PRs to add support for more.
Also note that it requires
sudo
for some commands to run
Usage
This package exports the only function - withOutline:
async function withOutline<T>(token: string, remoteAddr: string, callback: () => Promise<T>): Promise<T>
When invoked, it does the following:
- Runs a Shadowsocks client
that connects to Outline server using
token
provided as the first argument. - Routes all traffic to the
remoteAddr
via Shadowsocks local proxy (thanks to badvpn-tun2socks). - Invokes the
callback
as async function ("awaits" for the result). - Restores routing
- Shuts down Shadowsocks client
- Returns the result of
callback
execution
License: MIT