springzfx / cgproxy

Transparent Proxy with cgroup v2。透明代理,配合v2ray/Qv2ray食用最佳
GNU General Public License v2.0
344 stars 38 forks source link
cgroups-v2 gateway-proxy linux qv2ray tproxy transparent-proxy v2ray

Transparent Proxy powered by cgroup v2

Introduction

cgproxy will transparent proxy anything running in specific cgroup. It resembles with proxychains and tsocks in default setting.

Main feature:

Contents

Prerequest

How to build and install

distro install

build

# ready build dir
mkdir build
cd build
# generate
cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -Dbuild_execsnoop_dl=ON \
      -Dbuild_static=OFF \
      ..
# compile
make

Default usage

Configuration

Config file: /etc/cgproxy/config.json

{
    "port": 12345,
    "program_noproxy": ["v2ray", "qv2ray"],
    "program_proxy": [],
    "cgroup_noproxy": ["/system.slice/v2ray.service"],
    "cgroup_proxy": [],
    "enable_gateway": false,
    "enable_dns": true,
    "enable_udp": true,
    "enable_tcp": true,
    "enable_ipv4": true,
    "enable_ipv6": true,
    "table": 10007,
    "fwmark": 39283
}

Note: cgroup in configuration need to be exist, otherwise ignored

If you changed config, remember to restart service

sudo systemctl restart cgproxy.service

Global transparent proxy

Gateway proxy

Other useful tools provided in this project

NOTES

TIPS

Qv2ray config example

Licences

cgproxy is licenced under License: GPL v3

Known Issues