Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎样防止客户端Hosts文件失效 #1023

Open
Davider-code opened this issue Apr 4, 2024 · 5 comments
Open

怎样防止客户端Hosts文件失效 #1023

Davider-code opened this issue Apr 4, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Davider-code
Copy link

以前一直用hysteria v1版, 在客户端设置一下ACL就能防止本机的HOSTS文件中的规则生效, 但是用hysteria v2版, 客户端不支持ACL设置, 导致所有HOSTS规失效, 造成了非常大的麻烦, 请问除了设置ACL之外, 还有其它的办法可以解决这个问题吗?

@Davider-code Davider-code added the enhancement New feature or request label Apr 4, 2024
@tobyxdd
Copy link
Collaborator

tobyxdd commented Apr 4, 2024

如果是浏览器的话,可以考虑用 PAC?

@haruue
Copy link
Collaborator

haruue commented Apr 8, 2024

我在你提的上一个 Issue #950 里回答过这个问题。

考虑到现在的 hysteria 不支持客户端侧 acl。
你可以给 chrome 安装一个 switchyomega 插件, 添加三个情景模式:

  1. 代理。 填写 hysteria 的 socks5 (127.0.0.1:1080), 另一个是
  2. 代理。 这个要弄成无效的, 比如 socks5 255.255.255.254:23333。
  3. 自动切换。 这个是分流, 把你要屏蔽的域名分流到上述第二项无效代理的情景模式。 最后添加一条规则把所有流量分流到上述第一项的 hysteria。

如果你不希望安装浏览器扩展程序, 那么你可以额外下载一个 v2ray, 配置成 inbounds 和 outboubds 都是 socks, 其中 outbound 配置到 hysteria 客户端的 socks5 地址。 然后使用 v2ray 的 路由功能 配合 blackhole outbound 对你要屏蔽的域名进行屏蔽。

#950 (comment)
#950 (comment)

此外, 在路由器上运行 Hysteria 并配置成透明代理, 也可以让本机的 hosts 继续生效。

@Davider-code
Copy link
Author

我在你提的上一个 Issue #950 里回答过这个问题。

考虑到现在的 hysteria 不支持客户端侧 acl。
你可以给 chrome 安装一个 switchyomega 插件, 添加三个情景模式:

  1. 代理。 填写 hysteria 的 socks5 (127.0.0.1:1080), 另一个是
  2. 代理。 这个要弄成无效的, 比如 socks5 255.255.255.254:23333。
  3. 自动切换。 这个是分流, 把你要屏蔽的域名分流到上述第二项无效代理的情景模式。 最后添加一条规则把所有流量分流到上述第一项的 hysteria。

如果你不希望安装浏览器扩展程序, 那么你可以额外下载一个 v2ray, 配置成 inbounds 和 outboubds 都是 socks, 其中 outbound 配置到 hysteria 客户端的 socks5 地址。 然后使用 v2ray 的 路由功能 配合 blackhole outbound 对你要屏蔽的域名进行屏蔽。

#950 (comment) #950 (comment)

此外, 在路由器上运行 Hysteria 并配置成透明代理, 也可以让本机的 hosts 继续生效。

多谢大佬再次解答, 主要是安装插件再配置太麻烦了, hysteria V2 对ACL支持还有戏吗?

@haruue
Copy link
Collaborator

haruue commented Apr 9, 2024

可以试试 sing-box 这种同时支持 SOCKS5 入站Hysteria 2 出站路由规则 的第三方客户端, 应该可以满足你的需求。

@Davider-code
Copy link
Author

Davider-code commented Apr 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants