Skip to content

Allows you to dockerize zapret + dnscrypt-proxy and access them via any proxy protocol supported by sing-box

License

Notifications You must be signed in to change notification settings

F33RNI/zapret-sing-box-docker

Repository files navigation

📦 zapret-sing-box-docker

Docker image with zapret, dnscrypt-proxy and sing-box

Allows you to dockerize zapret + dnscrypt-proxy and access them via any proxy protocol supported by sing-box

Based on https://github.com/F33RNI/zapret-v2ray-docker [deprecated]


🏗️ Installation

1. Install Docker

https://docs.docker.com/engine/install/

2. Clone repo

git clone https://github.com/F33RNI/zapret-sing-box-docker.git
cd zapret-sing-box-docker

3. Build image

./build.sh

Edit .env file if needed

4. Edit config files

All configs are located in configs/ dir

Use provided zapret-discord-youtube-rules-converter.sh script to fetch and parse rules from https://github.com/Flowseal/zapret-discord-youtube and edit configs/zapret.conf accordingly

Or you can start the container (by calling start.sh) and use zapret-discord-youtube-rules-converter.sh with test argument to test parsed rules

# Start the container
TZ="Etc/UTC" ./start.sh

# Parse and test ALL rules from <https://github.com/Flowseal/zapret-discord-youtube> using custom URL
TEST_URL="https://rr1---sn-aigzrnld.googlevideo.com/videoplayback" ./zapret-discord-youtube-rules-converter.sh test

5. Provide ports and start the container

PORTS="127.0.0.1:2080:2080" TZ="Etc/UTC" ./start.sh

Please see comments in the .env file for more info

NOTE: To start without -d / --detach arg, use ./start.sh nd / ./start.sh nodetach instead

# Check zapret logs
tail -f logs/zapret.log

# Check dnscrypt-proxy logs
tail -f logs/dnscrypt-proxy.log

# Check sing-box logs
tail -f logs/sing-box.log

6. Wait a bit and test

curl --proxy "127.0.0.1:2080" --head -L https://youtube.com

⏹️ Stop the container

Simply run

./stop.sh rm

Specify rm argument to this script to remove the container


🔃 Reload configs

You can apply new config files without restarting the container. For that, simply run

./reload.sh

Optionally, to see logs after reload you can run

./reload.sh && tail -f logs/sing-box.log

🧱 Blockcheck

Simply start the container and run

`./blockcheck.sh`

So

./start.sh
# Wait a few seconds
./blockcheck.sh

Output will be written into logs/blockcheck.log

To edit domains, add DOMAINS variable to the .env file and run ./build.sh script again


🐧 Linux service (example)

/lib/systemd/system/zapret-sing-box-docker.service

[Unit]
Description=zapret-sing-box-docker service
After=docker.service network-online.target
Requires=docker.service network-online.target multi-user.target

[Service]
Type=simple
WorkingDirectory=/path/to/zapret-sing-box-docker
Environment=PORTS="0.0.0.0:2080:2080" TZ="Etc/UTC"
ExecStartPre=/usr/bin/sleep 5
ExecStart=/path/to/zapret-sing-box-docker/start.sh nd
ExecStop=/path/to/zapret-sing-box-docker/stop.sh rm
ExecReload=/path/to/zapret-sing-box-docker/reload.sh
Restart=on-failure
RestartSec=5
User=your-user-name
Group=your-user-name

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now zapret-sing-box-docker.service

🌲 Dependencies

About

Allows you to dockerize zapret + dnscrypt-proxy and access them via any proxy protocol supported by sing-box

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published