grand refactory to multiple list-based control api

This commit is contained in:
yggverse 2026-03-28 04:42:41 +02:00
parent 827cb182f2
commit b93c1e8481
15 changed files with 271 additions and 282 deletions

View file

@ -16,19 +16,13 @@ Filtering asynchronous SOCKS5 (TCP/UDP) proxy server based on [fast-socks5](http
## Usage
``` bash
RUST_LOG=trace cargo run -- --allow=http://localhost/allow.txt \
--allow=/path/to/allow.txt \
no-auth
RUST_LOG=trace cargo run -- -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/allow/<domain.com>` - add rule to the current session
* `/api/block/<domain.com>` - delete rule from the current session
* `/api/rules` - return active rules (from server memory)
* `/api/lists` - get parsed lists with its ID
* `/api/list/<ID>` - get all parsed rules for list ID (see `/api/lists`)
* `/api/list/enable/<ID>` - enable all parsed rules of given list ID (see `/api/lists`)
* `/api/list/disable/<ID>` - disable all parsed rules of given list ID (see `/api/lists`)
* `/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)
### Allow list example
@ -53,6 +47,7 @@ git clone https://codeberg.org/postscriptum/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
```
@ -68,9 +63,7 @@ Wants=network-online.target
User=psocks
Group=psocks
ExecStart=/usr/local/bin/psocks \
-a=http://localhost/allow.txt \
no-auth
ExecStart=/usr/local/bin/psocks -c=/etc/psocks.toml no-auth
Restart=always