{"id":13539496,"url":"https://github.com/zfl9/gfwlist2privoxy","last_synced_at":"2025-04-05T13:09:01.028Z","repository":{"id":102041649,"uuid":"89129642","full_name":"zfl9/gfwlist2privoxy","owner":"zfl9","description":"将 gfwlist.txt（Adblock Plus 规则）转换为 privoxy.action","archived":false,"fork":false,"pushed_at":"2023-05-06T04:10:33.000Z","size":98,"stargazers_count":331,"open_issues_count":0,"forks_count":164,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-29T12:09:00.518Z","etag":null,"topics":["gfwlist","gfwlist2privoxy","privoxy"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zfl9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-04-23T09:02:38.000Z","updated_at":"2025-03-06T03:38:05.000Z","dependencies_parsed_at":"2024-01-17T16:08:12.140Z","dependency_job_id":"af3ab5a5-040a-485a-9060-58e49aec3ab8","html_url":"https://github.com/zfl9/gfwlist2privoxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfl9%2Fgfwlist2privoxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfl9%2Fgfwlist2privoxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfl9%2Fgfwlist2privoxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zfl9%2Fgfwlist2privoxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zfl9","download_url":"https://codeload.github.com/zfl9/gfwlist2privoxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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","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":["gfwlist","gfwlist2privoxy","privoxy"],"created_at":"2024-08-01T09:01:26.715Z","updated_at":"2025-04-05T13:09:01.009Z","avatar_url":"https://github.com/zfl9.png","language":"Shell","funding_links":[],"categories":["\u003ca id=\"1a9934198e37d6d06b881705b863afc8\"\u003e\u003c/a\u003e通信\u0026\u0026代理\u0026\u0026反向代理\u0026\u0026隧道","Shell (473)","Shell","\u003ca id=\"af9d2b4988d35a2a634c042a1c66bb8c\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"837c9f22a3e1bb2ce29a0fb2bcd90b8f\"\u003e\u003c/a\u003e翻墙\u0026\u0026GFW","\u003ca id=\"e9cc4e00d5851a7430a9b28d74f297db\"\u003e\u003c/a\u003eGFW"],"readme":"# 适用于 privoxy 的 gfwlist.pac（socks5 代理）\n- 由于 macOS 的命令行参数与 Linux 命令行参数部分不一致，macOS 用户请使用 `gfwlist2privoxy-mac-zsh` 代替 `gfwlist2privoxy`。使用 `zsh` 能得到更好的提示效果。-- [c-rainstorm](https://github.com/c-rainstorm)\n- 现使用 Perl5 替代 sed、grep 等正则处理工具，应该不存在所谓参数不一致问题了，请先尝试 `gfwlist2privoxy`。-- [zfl9](https://github.com/zfl9)\n\n## 脚本依赖\n- base64\n- curl (https)\n- Perl5 v5.10.0+\n\n## 脚本用法\n- `curl -4sSkLO https://raw.github.com/zfl9/gfwlist2privoxy/master/gfwlist2privoxy`\n- `bash gfwlist2privoxy 127.0.0.1:1080`，注意将 `127.0.0.1:1080` 替换为你的 socks5 地址\n- `mv -f gfwlist.action /etc/privoxy/`，将 gfwlist.action 移动到 privoxy 配置文件目录\n- `echo 'actionsfile gfwlist.action' \u003e\u003e/etc/privoxy/config`，应用 gfwlist.action 配置文件\n- `systemctl restart privoxy.service`，重启 privoxy 服务，留意 privoxy 运行状态，检查是否有错误\n\n\u003e 更多信息，请参见: https://github.com/zfl9/gfwlist2privoxy/wiki\n\n## Adblock Plus 规则\n- 注释符：`!`开头的行均为注释行，会被 Adblock Plus 忽略，当然还有特殊注释，此处略过\n- 通配符：`*`匹配任意长度字符，并且默认假设字符串两边存在`*`，即`ad`与`*ad*`是一样的\n- 边界符：`|`位于模式首尾，用于取消首尾默认的`*`通配符，比如`|https://www.google.com/ad`\n- 子域符：`||`位于模式头部，用于匹配`http://*.`、`https://*.`协议字符串及子域部分（含当前域名）\n- 分隔符：`^`匹配 url 分隔符，如`http://192.168.1.1:8080/?a=1\u0026b=2`中的红色部分以及地址结尾（~~见下图~~）\n- 正则符：`/regex/`使用 Unix 路径分隔符括住正则表达式（Perl 正则）（应避免大量正则的使用，性能低）\n- 例外符：`@@`开头的模式，表示定义一个例外规则，如`@@||google.com^`、`@@/https?:\\/\\/.*\\.google\\..*/`\n\n## privoxy.action 规则\n- 协议部分：privoxy 已经默认假设存在`http://`、`https://`，因此不能再定义协议字符串\n- host 部分：使用 glob 模式，即`*`任意长度字符、`?`任意单个字符、`[set]`集合、`[^set]`集合（取反）\n- host 部分可以指定端口号，语法和平时指定端口号一样，比如：`www.zfl9.com:8989`、`192.168.1.1:8080`\n- host 部分除了可以是域名外，还可以是 IPv4、IPv6 地址，如果为 IPv6 地址，需用`\u003c\u003e`括起来（取消歧义）\n- uri 部分：使用 regex 模式（POSIX 扩展正则表达式，ERE，POSIX 1003.2），不支持非贪婪匹配等高级特性\n\nhost 部分的例子：\n- `/`，匹配所有 URL 请求，这是特殊模式\n- `:8080`，匹配所有目的端口为 8080 的请求\n- `192.168.1.1`，匹配目的主机 192.168.1.1 的所有请求\n- `\u003c2001:db8::1\u003e`，匹配目的主机 2001:db8::1 的所有请求\n- `www.zfl9.com/`，匹配 www.zfl9.com 下的所有请求\n- `www.zfl9.com`，匹配 www.zfl9.com 下的所有请求，末尾的 / 可以省略\n- `www.`，匹配所有以 www. 开头的域名下的所有请求（包括 www）\n- `.google.`，匹配所有包含 .google. 内容的域名下的所有请求（包括 google）\n- `.google.com`，匹配所有以 .google.com 结尾的域名下的所有请求（包括 google.com）\n\nprivoxy.action 典型写法：\n``` bash\n# 定义别名，可包含除空格、Tab、=、{} 外的任意字符\n{{alias}}\n# 代理(socks5)\nsocks5 = +forward-override{forward-socks5 127.0.0.1:1080 .}\n# 直连\ndirect = +forward-override{forward .}\n\n# 后面的规则会覆盖前面的规则，因此例外规则必须写在后面\n# 所有网站走代理 (一般情况写在前面)\n{socks5}\n/\n\n# 以下网站走直连 (特殊情况写在后面)\n{direct}\n.ip.cn\n.chinaz.com\n```\n\n更多 privoxy 用法请参考：[privoxy - 用户手册](https://www.privoxy.org/user-manual/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfl9%2Fgfwlist2privoxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfl9%2Fgfwlist2privoxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfl9%2Fgfwlist2privoxy/lists"}