Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imgk/shadow

A rule-based transparent proxy for Windows, Linux, macOS
https://github.com/imgk/shadow

gvisor http shadowsocks socks5 transparent-proxy trojan tun2shadowsocks tun2socks windivert wintun

Last synced: about 2 months ago
JSON representation

A rule-based transparent proxy for Windows, Linux, macOS

Awesome Lists containing this project

README

        

# Shadow

A transparent proxy client for Windows, Linux and macOS, which now supports shadowsocks, trojan, socks5, http and wireguard, as well as all methods supported by v2ray.

## How to build

Build with Go 1.16.

Replace `$(proto)` with names of proxies which you want to use. Currently shadow supports `socks`, `shadowsocks`, `trojan`, `http`, `wireguard` or `v2ray`.

```
# linux darwin windows,wintun
go get -v -ldflags="-s -w" -trimpath -tags="$(proto)" github.com/imgk/shadow

# windows,windivert
go get -v -ldflags="-s -w" -trimpath -tags="divert $(proto)" github.com/imgk/shadow
```

## How to use it

```
-> ~ go/bin/shadow -h
Usage of go/bin/shadow:
-c string
config file (default "config.json")
-t duration
timeout (default 3m0s)
-v enable verbose mode
```

### Windows

For WinTun, download [WinTun](https://www.wintun.net) and put `wintun.dll` in `C:\Windows\System32`.

For WinDivert, download [WinDivert](https://www.reqrypt.org/windivert.html) 2.2 and put `WinDivert.dll` and `WinDivert64.sys` in `C:\Windows\System32`.

#### GUI

Use shadow with simple GUI [shadow-windows](https://github.com/imgk/shadow-windows).

#### CLI

Run shadow.exe with administrator privilege.

```
go/bin/shadow.exe -c C:/Users/example/shadow/config.json -v
```

### Linux and OpenWrt Router

1. Set system DNS server. Please add DNS server to `ip_cidr_rules.proxy` for diverting all DNS queries to shadow.

```
sudo go/bin/shadow -c /etc/shadow.json -v
```

If you are using OpenWrt, you need to configure firewall.

```
# set tun name in the config.json
export TunName=utun

# configure firewall for OpenWrt
iptables -I FORWARD -o $TunName -j ACCEPT
iptables -t nat -I POSTROUTING -o $TunName -j MASQUERADE
```

### macOS

1. Set system DNS server. Please add DNS server to `ip_cidr_rules.proxy` for diverting all DNS queries to shadow.

```
sudo go/bin/shadow -c /etc/shadow.json -v
```

## Documentation

Please read [doc/README.md](https://github.com/imgk/shadow/blob/main/doc/README.md)

## TODO
- [ ] Set interface IPv6 address and IPv6 routes