1
3
Fork
You've already forked psocks
1
Filtering asynchronous SOCKS5 (TCP/UDP) proxy server https://crates.io/crates/psocks
  • Rust 100%
2026年07月12日 15:55:10 +00:00
example update config repository location 2026年07月10日 12:51:13 +03:00
src respect out rules order; update debug messages 2026年07月12日 15:55:10 +00:00
.gitignore initial commit 2026年03月22日 01:06:24 +02:00
Cargo.lock respect out rules order; update debug messages 2026年07月12日 15:55:10 +00:00
Cargo.toml respect out rules order; update debug messages 2026年07月12日 15:55:10 +00:00
LICENSE Initial commit 2026年03月22日 00:02:29 +01:00
README.md add badges 2026年07月10日 19:31:13 +00:00

psocks

dependency status crates.io

Filtering asynchronous SOCKS5 (TCP/UDP) proxy server based on fast-socks5, featuring allowlist-based access control that drops everything except what is allowed by the user. Includes JSON/API based on Rocket framework.

 |---> out proxy (SOCKS5 / TCP)
app ---> psocks filter ---|
 |---> direct (TCP or UDP)

Goals

  • Ad/tracking protection (before sending a DNS request)
  • Reduce CPU usage by filtering extra SSL traffic on background

Roadmap

  • SOCKS5 (TCP/UDP) server
    • Optional out proxy
      • TCP
      • UDP
  • Web JSON/API
    • Web UI

Install

cargo install psocks

Usage

RUST_LOG=trace psocks -c=/path/to/config.toml no-auth
  • set socks5://127.0.0.1:1080 proxy in your application
  • use http://127.0.0.1:8010 for API:
    • /api/totals - blocking summary
    • /api/list/enable/<ID> - enable all parsed rules of given list ID ([list.ID] in your config)
    • /api/list/disable/<ID> - disable all parsed rules of given list ID ([list.ID] in your config)
    • /api/list/reload/<ID> - reload list rules from its source by list ID ([list.ID] in your config)
    • /api/list/reload - reload all lists rules from their source

Allow list example

# /path/to/allow.txt
// exact match
duckduckgo.com
// google.com with subdomains
.google.com
// IP
1.2.3.4
// CIDR
0200::/7

systemd

git clone https://codeberg.org/yggverse/psocks.git
cd psocks
cargo build --release --locked
sudo install target/release/psocks /usr/local/bin
sudo cp example/config.toml /etc/psocks.toml
sudo useradd -s /usr/sbin/nologin -Mr psocks
sudo mkdir /var/log/psocks && sudo chown psocks:psocks /var/log/psocks
#/etc/systemd/system/psocks.service
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
User=psocks
Group=psocks
ExecStart=/usr/local/bin/psocks -c /etc/psocks.toml no-auth
Restart=always
Environment="RUST_LOG=psocks=warn"
Environment="NO_COLOR=1"
StandardOutput=file:///var/log/psocks/debug.log
StandardError=file:///var/log/psocks/error.log
[Install]
WantedBy=multi-user.target
  • sudo systemctl restart psocks
  • sudo systemctl enable psocks
  • sudo systemctl status psocks