{"id":16991881,"url":"https://github.com/kjagiello/pacgen","last_synced_at":"2025-09-07T10:33:30.115Z","repository":{"id":51065625,"uuid":"369784932","full_name":"kjagiello/pacgen","owner":"kjagiello","description":"Easily create a PAC file from a TOML config.","archived":false,"fork":false,"pushed_at":"2021-05-25T08:09:02.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T06:19:25.473Z","etag":null,"topics":["proxy","proxy-configuration","socks","toml","toml-config"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kjagiello.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-22T10:59:38.000Z","updated_at":"2022-06-08T06:43:59.000Z","dependencies_parsed_at":"2022-09-19T03:10:40.447Z","dependency_job_id":null,"html_url":"https://github.com/kjagiello/pacgen","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kjagiello/pacgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjagiello%2Fpacgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjagiello%2Fpacgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjagiello%2Fpacgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjagiello%2Fpacgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kjagiello","download_url":"https://codeload.github.com/kjagiello/pacgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjagiello%2Fpacgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026691,"owners_count":25209739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proxy","proxy-configuration","socks","toml","toml-config"],"created_at":"2024-10-14T03:27:38.417Z","updated_at":"2025-09-07T10:33:30.061Z","avatar_url":"https://github.com/kjagiello.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pacgen - Proxy Auto-Config (PAC) generator\n\nGenerates a [PAC file][pac-def] from a TOML config.\n\n[pac-def]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file\n\n## Features\n\n- Supported rules:\n    - Forwarding traffic to a proxy based on hostnames (with support for globs)\n- Built-in server for serving the generated PAC file\n\n## Usage\n\n### Using the Docker image\n\n#### Generate a PAC file from a TOML file\n\n```shell\ndocker run \\\n    --rm -it \\\n    -v $(pwd)/your-proxy.toml:/proxy.toml \\\n    ghcr.io/kjagiello/pacgen:latest \\\n    proxy.toml\n```\n\n#### Generate and serve the PAC file\n\nThe HTTP server binds by default at `127.0.0.1:8080`.\n\n```shell\ndocker run \\\n    --rm -it \\\n    -v $(pwd)/your-proxy.toml:/proxy.toml \\\n    -p 127.0.0.1:8080:8080 \\\n    ghcr.io/kjagiello/pacgen:latest \\\n    -h 0.0.0.0\n    -s proxy.toml\n```\n\n## Example config\n\n```toml\n[proxies]\nsecret-tunnel = { type = \"SOCKS\", host = \"10.0.0.1\", port = 1080 }\ncorporate-tunnel = { type = \"HTTPS\", host = \"10.0.0.2\", port = 443 }\ndirect = { type = \"DIRECT\" }\n\n[[rules]]\n# A fail-close mechanism. If the user is visiting \"*.fbi.gov\", require that the\n# traffic flows through the \"secret-tunnel\" proxy.\nproxy = [\"secret-tunnel\"]\nallowed_hosts = [\"*.fbi.gov\"]\n\n[[rules]]\n# A fail-open mechanism. For any traffic, try to route it through the\n# \"corporate-tunnel\" proxy and in case of the failure, let the traffic bypass\n# the proxy.\nproxy = [\"corporate-tunnel\", \"direct\"]\n```\n\n## The config format\n\n- [[proxies]](#proxies) – Defines a proxy.\n    - [type](#the-type-field) – The type of the proxy.\n    - [host](#the-host-field) – The host of the proxy.\n    - [port](#the-port-field) – The port of the proxy.\n- [[[rule]]](#rule) – Defines a routing rule.\n    - [proxy](#the-proxy-field) – The proxies to be used by the rule.\n    - [allowed_hosts](#the-allowed_hosts-field) – The hosts that trigger the rule.\n\n### Proxies\n\nThe first section in the config specifies the proxies that are available to use\nby the rules. Each proxy has to be given name that will be used to reference\nthem from the rules.\n\n```toml\n[proxies]\nproxy-a = { type = \"SOCKS\", host = \"10.0.0.1\", port = 1080 }\nproxy-b = { type = \"SOCKS\", host = \"10.0.0.2\", port = 1081 }\n```\n\n#### The `type` field\n\nAvailable values:\n\n- `DIRECT`\n- `SOCKS`\n- `SOCKS4`\n- `SOCKS5`\n- `HTTP`\n- `HTTPS`\n\nThe `DIRECT` type is a special one, because it instructs the traffic to not\nflow through any proxy and does thus not require `host` and `proper` fields to\nbe specified.\n\n#### The `host` field\n\nSpecifies which host the proxy is available at.\n\n#### The `port` field\n\nSpecifies which port the proxy is available at.\n\n### Rule\n\nList of rules that are evaluated in the order they appear in in the config. In the example below,\nthe traffic to `*.evil.corp` will be routed through the `corporate-tunnel`\nproxy, while all other traffic will go straight to the target.\n\n```toml\n[[rules]]\nproxy = [\"corporate-tunnel\"]\nallowed_hosts = [\"*.evil.corp\"]\n\n[[rules]]\nproxy = [\"direct\"]\n```\n\n#### The `proxy` field\n\nA list of the proxy identifieries defined in [[proxies]](#proxies).\n\n#### The `allowed_hosts` field\n\nA list of the hosts that the rule should be triggered for. Every entry in this\nlist supports following globs:\n\n- `?` – any single character. Example: `?.evil.corp` (will match `d.evil.corp`,\n  but not `an.evil.corp`)\n- `*` – any number of characters. Example: `*.evil.corp`\n\n### CLI documentation\n\n```\nUSAGE:\n    pacgen [FLAGS] [OPTIONS] \u003cCONFIG\u003e\n\nFLAGS:\n        --help       Prints help information\n    -s, --serve      Serves the generated PAC file\n    -V, --version    Prints version information\n\nOPTIONS:\n    -h \u003chost\u003e        Host to bind the PAC server at [default: 127.0.0.1]\n    -p \u003cport\u003e        Port to bind the PAC server at [default: 8080]\n\nARGS:\n    \u003cCONFIG\u003e    Path to the config file to use (- for STDIN).\n```\n\n## Configuring PAC\n\n### macOS\n\n1. Open **System Preferences**\n2. Go to **Network**\n3. Choose the active network in the list to the left\n4. Open **Advanced...**\n5. Go to the **Proxies** tab.\n6. Activate **Automatic Proxy Configuration**.\n7. Set the URL to http://localhost:8080.\n8. Press **Ok** and then **Apply**.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg\n        src=\"https://user-images.githubusercontent.com/74944/119229679-6b144880-bb19-11eb-9d2f-fa9388e4c6f4.png\"\n        alt=\"Automatic Proxy Configuration screenshot\"\n    /\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjagiello%2Fpacgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjagiello%2Fpacgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjagiello%2Fpacgen/lists"}