{"id":15320985,"url":"https://github.com/zijiren233/sniproxy","last_synced_at":"2026-05-13T02:34:03.094Z","repository":{"id":234249194,"uuid":"788509756","full_name":"zijiren233/sniproxy","owner":"zijiren233","description":"sniproxy with nginx","archived":false,"fork":false,"pushed_at":"2026-02-28T16:06:19.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-28T19:25:37.265Z","etag":null,"topics":["nginx","proxy","script","sniproxy","web"],"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/zijiren233.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-18T14:56:17.000Z","updated_at":"2026-02-28T16:04:12.000Z","dependencies_parsed_at":"2024-05-22T06:43:50.000Z","dependency_job_id":"2aa915a8-fdaf-483e-9a5a-e5245f849a64","html_url":"https://github.com/zijiren233/sniproxy","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"e4efdd3ccb1e8d4ec1862890c1a5200402348345"},"previous_names":["zijiren233/sniproxy"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/zijiren233/sniproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijiren233%2Fsniproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijiren233%2Fsniproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijiren233%2Fsniproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijiren233%2Fsniproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zijiren233","download_url":"https://codeload.github.com/zijiren233/sniproxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zijiren233%2Fsniproxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32965399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"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":["nginx","proxy","script","sniproxy","web"],"created_at":"2024-10-01T09:09:32.760Z","updated_at":"2026-05-13T02:34:03.089Z","avatar_url":"https://github.com/zijiren233.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sniproxy\n\n## 创建需要代理的域名列表 `domains.txt` 以及设置这些域名解析到的IP地址（解锁机的IP）\n\n- `domains.txt.example` 为示例文件，可以参考此文件创建 `domains.txt`\n- `//` 开头的行用来注释，此行不会被解析\n- `#` 为 `AdGuardHome` 所用\n  - 用于AdGuardHome的DNS重写\n  - `#` 开头的行为设置此行之后的域名解析到的 IP 地址\n  - 可以重复定义 `#` 行，用来设置此行之后的域名的 IP 地址\n  - 多个IP用 `,` 分隔，如 `1.1.1.1,2606:4700:4700::1111`\n  - 可以通过 `echo $(curl -s ifconfig.me -4),$(curl -s ifconfig.me -6)` 命令获取本机的IP地址\n- `^` 为 `AdGuardHome` 所用\n  - 用于设置AdGuardHome的上游DNS\n  - 可以设置多个上游DNS，用 `,` 分隔，如 `^1.1.1.1,2606:4700:4700::1111` 表示使用 `1.1.1.1` 和 `2606:4700:4700::1111` 作为上游DNS\n  - 默认为 `h3://dns.google/dns-query,https://dns11.quad9.net/dns-query`\n- `$` 为 `AdGuardHome` 所用\n  - 用于设置AdGuardHome的admin密码\n  - 如果未设置，则默认密码为 `adminadmin`\n  - [需要apache2](https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#password-reset)\n    - `apt install apache2-utils`\n    - `dnf install httpd-tools`\n- `!` 为 `nginx` 所用\n  - 用于指定接下来的域名使用的出口IP是 `ipv4` 还是 `ipv6`\n  - 也可以使用多个IP，用 `,` 分隔，如 `!1.1.1.1,2606:4700:4700::1111` 表示使用 `1.1.1.1` 和 `2606:4700:4700::1111` 作为出口IP\n  - 支持使用网卡名称，格式为 `!device:网卡名称 ipv4/ipv6`，如 `!device:warp ipv4` 表示使用 `warp` 网卡的IPv4地址作为出口IP\n    - 可以省略IP版本，默认获取网卡的**所有IP地址**（包括IPv4和IPv6），如 `!device:warp` 会使用 `warp` 网卡的所有IP\n    - 指定IP版本只获取对应版本的IP，如 `!device:warp ipv4` 只获取IPv4地址，`!device:warp ipv6` 只获取IPv6地址\n    - 可以配置多个网卡，如 `!device:warp ipv4,device:eth0 ipv6`\n    - 支持混合配置IP地址和网卡，如 `!1.1.1.1,device:warp ipv4,2.2.2.2`\n    - **注意：单独的 `ipv4`/`ipv6` 关键字不能与具体的IP地址或device配置混合使用**\n      - ✅ 正确：`!ipv4` 或 `!ipv6` 或 `!1.1.1.1,2.2.2.2` 或 `!device:warp,device:eth0`\n      - ❌ 错误：`!ipv4,1.1.1.1` 或 `!ipv6,device:warp`\n    - entrypoint会自动监控网卡IP变更，当检测到变更时会自动重新生成配置并重载nginx\n  - 如果遇到空行会重置为默认\n- `@` 为 `nginx` 所用\n  - 定义在每个域名后面，用于指定此域名的源服务器地址\n  - 可以是域名或者IP地址\n  - 可以定义端口，如果未定义则默认为 `443`\n  - 支持端口范围，如 `127.0.0.1:5000-5020` 会展开为 `127.0.0.1:5000` 到 `127.0.0.1:5020` 的所有端口\n  - 值会传递给 `upstream` 的 `server`，如果有多个地址，则用 `;` 分隔\n  - 如: `netflix.com @127.0.0.1:443` 表示 `netflix.com` 使用 `127.0.0.1:443` 作为上游服务器\n  - 如: `netflix.com @1.1.1.1:1000-1005 weight=5; 2.2.2.2 weight=10` 表示 `netflix.com` 使用 `1.1.1.1:1000` 到 `1.1.1.1:1005` 和 `2.2.2.2:443` 作为上游服务器，且权重大小分别为 `5` 和 `10`\n  - 更多配置请参考 [nginx upstream](https://nginx.org/en/docs/stream/ngx_stream_upstream_module.html)\n  - 也可以定义为 `@` 开头的行，用于指定接下来所有域名使用的源服务器地址\n  - 如果遇到空行会重置为默认\n- 默认情况下域名使用hostname匹配，如 `github.com` 可以匹配 `api.github.com` 和 `github.com`\n  - `=` 开头表示精确匹配\n    - 如: `=github.com` 表示精准匹配 `github.com`，无法匹配到 `api.github.com`\n  - `*` 开头或结尾表示通配符匹配\n    - 如: `*.github.com` 可以匹配 `api.github.com` 但不能匹配 `github.com`\n    - 如: `github.*` 可以匹配 `github.com` 和 `github.net`\n  - `~` 开头表示正则匹配\n    - 如: `~^api\\..*\\.com$` 可以匹配所有以api开头的.com域名\n    - 如: `~^.*$` 可以匹配所有域名\n- `\u003c` 为 `nginx` 所用\n  - 用于指定接下来的域名的速率\n  - 如果遇到空行会重置为默认\n  - 值会传递给 `proxy_download_rate` 和 `proxy_upload_rate`\n  - 如: `\u003c1k` 表示下载和上传速率限制为 `1k`\n- `\u0026` 为 `nginx` 所用\n  - 用于指定全局允许的ip白名单\n  - 如果没有设置，则默认允许所有ip\n  - 值会传递给 `allow`，且最后会附加一个 `deny all`\n  - 允许配置多个 `\u0026` 行，每行内可以有多个IP，用 `,` 分隔\n  - 如: `\u00261.1.1.1,2606:4700:4700::1111` 表示只允许 `1.1.1.1` 和 `2606:4700:4700::1111` 访问\n- 对于有空行就重置的配置，如 `!` `@` `\u003c` 等，可以连续两个 `!!` `@@` `\u003c\u003c` 来设置全局默认值，此时遇到空行也会使用全局默认值\n- `` ` `` 和 `` ``` `` 为 `nginx` 所用\n  - 用于指定代码块到 `stream` 模块中\n  - 比如：\n\n````txt\n` server { listen 22; proxy_pass github.com:22; } `\n\n```\nserver { \n    listen 22; \n    proxy_pass github.com:22; \n}\n```\n````\n\n### `domains.txt` 示例\n\n#### 示例1：使用IP地址\n\n前提条件：\n\n- 有两台服务器\n- 第一台服务器的IP地址为 `1.1.1.1,2606:4700:4700::1111`\n  - 第一台服务器解锁Netflix\n  - 且只有ipv6解锁Netflix\n- 第二台服务器的IP地址为 `1.0.0.1,2606:4700:4700::1001,2606:4700:4700::1002`\n  - 第二台服务器解锁Disney和TikTok\n  - 且只有`2606:4700:4700::1002`解锁Disney\n\n```txt\n#1.1.1.1,2606:4700:4700::1111\n\n// Netflix\n!ipv6\nnetflix.com\nnetflix.net\nnflximg.com\nnflximg.net\nnflxvideo.net\nnflxso.net\nnflxext.com\n\n#1.0.0.1,2606:4700:4700::1001\n\n// Disney\n!2606:4700:4700::1002\ndisney.com\ndisneyjunior.com\nadobedtm.com\nbam.nr-data.net\nbamgrid.com\nbraze.com\ncdn.optimizely.com\ncdn.registerdisney.go.com\ncws.conviva.com\nd9.flashtalking.com\ndisney-plus.net\ndisney-portal.my.onetrust.com\ndisney.demdex.net\ndisney.my.sentry.io\ndisneyplus.bn5x.net\ndisneyplus.com\ndisneyplus.com.ssl.sc.omtrdc.net\ndisneystreaming.com\ndssott.com\nexecute-api.us-east-1.amazonaws.com\njs-agent.newrelic.com\n\n// TikTok\nbyteoversea.com\nibytedtos.com\nipstatp.com\nmuscdn.com\nmusical.ly\np16-tiktokcdn-com.akamaized.net\nibyteimg.com\nsgpstatp.com\nsnssdk.com\ntik-tokapi.com\ntiktok.com\ntiktokcdn.com\ntiktokv.com\n```\n\n#### 示例2：使用网卡名称\n\n前提条件：\n\n- 本地有两个网卡\n- `warp` 网卡可以解锁Netflix（使用IPv6）\n- `eth0` 网卡可以解锁Disney和TikTok\n\n```txt\n// Netflix - 使用warp网卡的IPv6地址\n!device:warp ipv6\nnetflix.com\nnetflix.net\nnflximg.com\nnflximg.net\nnflxvideo.net\nnflxso.net\nnflxext.com\n\n// Disney - 使用eth0网卡的IPv4地址\n!device:eth0 ipv4\ndisney.com\ndisneyjunior.com\ndisneyplus.com\ndisneystreaming.com\n\n// TikTok - 使用eth0网卡的所有IP地址（IPv4和IPv6）\n!device:eth0\ntiktok.com\ntiktokcdn.com\ntiktokv.com\n```\n\n## 运行服务\n\n```bash\n# 直接运行会使用ipv4或ipv6请求代理域名，取决于linux优先级配置\nbash run-nginx.sh\n\n# 如果默认使用绑定ip请求代理域名\nbash run-nginx.sh -b \u003cip\u003e\n\n# 默认绑定443端口，如果要绑定其他端口或多个端口，则使用 -p 参数\nbash run-nginx.sh -p \u003cport1\u003e,\u003cport2\u003e -p \u003cport3\u003e\n\n# 如果你修改了domains.txt文件，会自动重载不需要重启\n\n# 使用指定dns\nbash run-nginx.sh -d 1.1.1.1\n\n# 启动AdGuardHome服务\nbash run-adguardhome.sh\n```\n\n运行后，nginx会监听80和443端口，AdGuardHome会监听53和8080端口，其中53端口为dns端口，`8080` 端口为web管理端口。\n\n把服务器的dns设置为AdGuardHome的IP地址，这样就可以实现通过AdGuardHome的DNS重写来解锁Netflix、Disney和TikTok。\n\n其中，AdGuardHome的 `8080` 端口还可以当作 `doh(dns over http)` ，注意并不是 `dns over https`\n\n如果要启用 `doh(dns over https)` 建议使用反向代理或cloudflare的cdn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzijiren233%2Fsniproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzijiren233%2Fsniproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzijiren233%2Fsniproxy/lists"}