Skip to content

alperensert/pac-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pac-server

Minimal PAC (Proxy Auto-Configuration) server written in C. Serves a PAC file that routes specific domains through configured proxies while everything else goes direct.

PAC is natively supported by all major browsers and can be applied system-wide through OS-level proxy settings (GNOME, Windows, macOS).

Build & Install

make
make install  # installs to ~/.local/bin

Configuration

Create a config file (see config.example):

SOCKS5 127.0.0.1:1080
discord.com
discord.gg
discordapp.com

PROXY 192.168.1.100:3128
example.com
example.org

Each proxy line (SOCKS5, SOCKS4, SOCKS, PROXY, HTTP, HTTPS) starts a group. Domains listed below it route through that proxy.

Usage

pac-server -c /path/to/config      # custom config (default: /etc/pac-server/config)
pac-server -p 9000                  # custom port (default: 8321)
pac-server -c config -p 9000       # both

Then set your automatic proxy configuration URL to http://127.0.0.1:8321/.

Systemd user service

# ~/.config/systemd/user/pac-server.service
[Unit]
Description=PAC proxy auto-config server
After=network.target

[Service]
ExecStart=%h/.local/bin/pac-server -c %h/.config/pac-server/config
Restart=on-failure

[Install]
WantedBy=default.target
systemctl --user enable --now pac-server

Disclaimer

Like every other repo on GitHub, this project is for educational purposes only. Whatever you do with it — including bypassing your government's shitty restrictions — is not up to me.

About

Minimal, configurable PAC server written in C

Topics

Resources

License

Stars

Watchers

Forks

Contributors