Home

Awesome

<h1 align="center">jet</h1>

NOTE: Cluster support in 4.4.0 is not good enough for daily use. So please use 4.3.4. I have no time to improve it. PR is welcome to improve cluster support.

<p align="center">An HTTP pre-proxy for SOCKS.</p> <p align="center"> <a href="http://standardjs.com/" target="_blank"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat" alt="Standard - JavaScript Style Guide"></a> <a href="http://m31271n.com/" target="_blank"><img src="https://img.shields.io/badge/made%20by-m31271n-brightgreen.svg?style=flat" alt="Made by m31271n"></a> <img src="https://img.shields.io/badge/license-GPL--3.0-brightgreen.svg?style=flat" alt="License - GPL-3.0"> </p>

The name "jet" is inspired by Jet Black from Cowboy Bepop.

Index

<!-- start: markdown-toc --> <!-- end: markdown-toc -->

What does Jet do?

                                      ┌──────────────────────┐
                                      │SOCKS v4/v4a/v5 Proxy │
                                ┌────▶│  (ShadowSocks etc.)  │──────┐
                                │     └──────────────────────┘      │
                                │                                   ▼
     ┌──────────────────┐     ┌───┐                            ┌────────┐
     │ User Application │────▶│Jet│───────────────────────────▶│Internet│
     └──────────────────┘     └───┘                            └────────┘

Features

Requirements

Installation

npm install -g @2players/jet@4.3.4

Setting Jet via environment variables

Format instruction:

VAR - DEFAULT VALUE

Change SOCKS Proxy setting via 3 environment variables:

Change setting of listening:

Running Jet

# sync GeoIP info
shell> jet sync-geoip

# jet runs on 127.0.0.1:9527 by default
shell> jet run

# run jet on another port, like 9600
shell> JET_LISTEN_PORT=9600 jet run

# after a period of time, you maybe want to update GeoIP info,
# just sync it again
shell> jet sync-geoip

Configure All Your Application To Use Jet.

For GUI

I think you know how to set this. It's simple.

For CLI

Suppose that Jet is running at 127.0.0.1:9527.

CHANNEL="http://127.0.0.1:9527"
NO_CHANNEL="localhost,127.0.0.1"

PROXY_ENV="http_proxy ftp_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY"
NO_PROXY_ENV="no_proxy NO_PROXY"
for envar in $PROXY_ENV; do
    export $envar=$CHANNEL
done

for envar in $NO_PROXY_ENV; do
    export $envar=$NO_CHANNEL
done

unset CHANNEL
unset NO_CHANNEL
unset PROXY_ENV
unset NO_PROXY_ENV

Add above script to your shell init file, like ~/.bashrc. Then source it.

If you are using other shell, set above environment variables by yourself.

Test The Effects

Test Jet is Working Or Not

shell> curl --proxy localhost:9527 https://www.google.com/

If you get right content, then jet is working.

Test Your Shell Environment Is Set Properly Or Not

shell> curl https://www.google.com/

If you get right content, then jet is working. And your shell environment is set properly, too.

Advanced Features

Hot switching mode

By defaut, jet is running in auto mode (a mode that routes request according GeoIP). In addition to this mode, there are two other mode:

When you run jet in terminal, you'll get this:

[INFO] Reading GeoIP info.
[INFO] DNS: 127.0.0.1
[INFO] Listening on 127.0.0.1:9527.
> TUNNEL 127.0.0.1 -> https://live.github.com:443/
> TUNNEL 127.0.0.1 -> https://live.github.com:443/

In order to hot switch current mode, just type supported mode directly. Take direct mode as an example:

[INFO] Reading GeoIP info.
[INFO] DNS: 127.0.0.1
[INFO] Listening on 127.0.0.1:9527.
> TUNNEL 127.0.0.1 -> https://live.github.com:443/
> TUNNEL 127.0.0.1 -> https://live.github.com:443/
direct  <- the mode you type
[INFO] Switch to direct mode
> DIRECT 127.0.0.1 -> https://live.github.com:443/

Uninstallation

If you think jet is not suitable for you, remove it with following commands:

# remove npm package
shell> npm uninstall -g jet

# remove related directory
shell> rm -rf ~/.config/jet

Reference

Similar Tools