Code Monkey home page Code Monkey logo

ts-warp's Introduction

TS-Warp

CodeQL C/C++ CI - macOS C/C++ CI - Ubuntu

Transparent proxy server and traffic wrapper

Buy Me A Coffee

Features

  • Proxy services with TCP-traffic redirection to external Socks4/5, HTTPS and SSH2* proxy servers

    • Transparent firewall-based traffic redirector
    • Internal Socks and HTTPS proxy server

    * Requires libssh2 library

  • Supported platforms:

    OS PF ip/nftables
    macOS
    FreeBSD
    OpenBSD
    Linux
    Windows WSL2
  • Main features

    Transparent proxy Socks5 Socks4 HTTPS SSH2
    Proxy protocol
    Proxy chains ⬜*
    Proxy workload balancer
    Authentication
    IPv6 stack support
    Remote names resolution: NS-Warp

    * Only one SSH2 proxy server allowed per chain

    Internal proxy Socks5 HTTPS
    Proxy protocol
    Proxy chains
    Proxy workload balancer
    Authentication
    IPv6 stack support
    Remote names resolution
  • Miscellaneous features

    • Simple configuration structure as INI-like file
    • Password encoding (obfuscation) in configuration files
    • Daemon mode
    • Front-end UI
    • Installation script (via Makefile)
  • TODO

    • UDP support
    • Internal Socks4 proxy support
    • Socks4a protocol support
    • OS specific select alternatives: epol / kqueue
    • Faster NS-Warp
    • Documentation

Changelog

Attention! To incorporate HTTP proxy service, socks_* variables in ts-warp.ini are replaced by proxy_* ones. The deprecated variables will be eventually removed in the further releases

See it here

Quick Installation

# If SSH2 proxy support is required, install https://libssh2.org library first, then download ts-warp:

git clone https://github.com/mezantrop/ts-warp && cd ts-warp

# `configure` script understands a number of environmental variables. You can force setting values to:
# `PREFIX`, `WITH_TCP_NODELAY`, `WITH_LIBSSH2`, `USER`, otherwise they will be auto-detected.

./configure && make && sudo make install clean

# Copy and edit configuration files
sudo cp /usr/local/etc/ts-warp.ini.sample /usr/local/etc/ts-warp.ini && sudo vi /usr/local/etc/ts-warp.ini

# on *BSD and macOS
sudo cp /usr/local/etc/ts-warp_pf.conf.sample /usr/local/etc/ts-warp_pf.conf
sudo vi /usr/local/etc/ts-warp_pf.conf

# on Linux with nftables
sudo cp /usr/local/etc/ts-warp_nftables.sh.sample /usr/local/etc/ts-warp_nftables.sh
sudo vi /usr/local/etc/ts-warp_nftables.sh

# on Linux with iptables
sudo cp /usr/local/etc/ts-warp_iptables.sh.sample /usr/local/etc/ts-warp_iptables.sh
sudo vi /usr/local/etc/ts-warp_iptables.sh

# on Windows WSL2 (Ubuntu) with iptables; Required packages for CLI: clang/gcc, make. For GUI-Warp: python3-tk
wsl --set-default-version 2

sudo cp /usr/local/etc/ts-warp_iptables.sh.sample /usr/local/etc/ts-warp_iptables.sh
sudo vi /usr/local/etc/ts-warp_iptables.sh

Usage

You can control, e.g. start, stop ts-warp daemon using ts-warp.sh script. Under root privileges or sudo run:

# <PREFIX>/etc/ts-warp.sh start|stop|reload|restart [options]
# <PREFIX>/etc/ts-warp.sh status

For example:

sudo /usr/local/etc/ts-warp.sh start
sudo /usr/local/etc/ts-warp.sh stop

After succesfull start, TS-Warp transparently redirects traffic according to the configuration specified in ts-warp.ini and firewall rules. Also, TS-Warp spawns Socks5 proxy server at localhost:10800 and HTTPS proxy (CONNECT method) at localhost:8080.

Low-level ts-warp daemon usage

All the ts-warp command-line options can be listed using $ ts-warp -h:

Usage:
  ts-warp -T IP:Port -S IP:Port -H IP:Port -c file.ini -l file.log -v 0-4 -t file.act -d -p file.pid -f -u user -h

Version:
  TS-Warp-X.Y.Z

All parameters are optional:
  -T IP:Port      Local IP address and port for incoming Transparent requests
  -S IP:Port      Local IP address and port for internal Socks server
  -H IP:Port      Local IP address and port for internal HTTP server

  -l file.log     Main log filename
  -v 0..4         Log verbosity level: 0 - off, default: 3
  -t file.act     Active connections and traffic log

  -d              Daemon mode
  -p file.pid     PID filename
  -f              Force start

  -u user         A user to run ts-warp, default: nobody

  -h              This message

ts-warp.sh respects ts-warp daemon options. For example, to temporary enable more verbose logs, restart ts-warp with -v 4 option:

sudo /usr/local/etc/ts-warp.sh restart -v 4

ts-warp understands several signals:

  • SIGHUP signal as the command to reload configuration
  • SIGUSR1 to display current configuration state. Note, load balancer can dynamically reorder configuration sections
  • SIGUSR2 to show active clients connection status and traffic stats
  • SIGINT to stop the daemon.

Use ts-pass to encode passwords if requred. See examples in ts-warp.ini

GUI front-end

gui-warp.py

The GUI front-end application to control ts-warp daemon can be installed from the gui directory:

cd gui
sudo make install

Optionally. Set PREFIX, to use a different installation target in the make command above:

sudo make install PREFIX=/path/to/install

To start the GUI run:

sudo -b <PREFIX>/bin/gui-warp.py

Note, Python 3 interpreter with tkinter support is required to run the GUI frontend.

macOS All-in-one TS-Warp + GUI-Warp App

Check releases and download macOS standalone precompiled application. Read related README.md for information and instructions.

Contacts

Not so early stage of development, yet don't expect everything to work properly. If you have an idea, a question, or have found a problem, do not hesitate to open an issue or mail me: Mikhail Zakharov [email protected]

Many thanks to contributors of the project

ts-warp's People

Contributors

mezantrop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ts-warp's Issues

TS-Warp Unable to start failing with the below error.

Stopping ts-warp with force: zsh: killed sudo /usr/local/etc/ts-warp.sh stop -f
akshay@Akshay's MacBook etc %
akshay@Akshay's MacBook etc % sudo /usr/local/etc/ts-warp.sh start -f
Starting ts-warp: pfctl: Use of -f option, could result in flushing of rules
present in the main ruleset added by the system at startup.
See /etc/pf.conf for further details.

No ALTQ support in kernel
ALTQ related functions disabled
done
akshay@Akshay's MacBook etc % sudo /usr/local/etc/ts-warp.sh status
ts-warp is not running: done
akshay@Akshay's MacBook etc %

Unable to configure failover for SOCKS proxy servers

I downloaded, compiled and installed the current branch of code and my log reports I am running 1.1.6. I modified my ts-warp.ini similar to following example. I used an IP address that is currently not in use for the first entry expecting it to attempt to connect, fail and then try the second entry. However, I seem to just continually retry the first entry. Is this failover logic currently implemented or am I misunderstanding the function?

[XX Proxy1]
section_balance = failover
target_host= 1.1.1.1
socks_server =2.2.2.2:1080

[XX Proxy2]
section_balance = failover
target_host = 1.1.1.1
socks_server = 3.3.3.3:1080

Exclude some targets from proxying and connect them directly

Are there any options to exclude some targets (Domain, IP range, etc...) from going through the proxies?

I don't know maybe by defining excluded_target_domain=XXX or something like the below:

[DIRECT]
proxy_type=direct
target_domain=domain.com

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.