hysteria icon indicating copy to clipboard operation
hysteria copied to clipboard

关于hysteria2二级代理

Open caco12138 opened this issue 1 year ago • 9 comments

请问在使用了MisakaNo这位大佬的hysteria2一键脚本搭建hy2节点后,导入nekoray使用 6n12u.png 但是我想设置hy2的二级代理我应该怎么做呢?我想达到主力服务器在访问奈飞,paypal或者某些网站时转发到hk落地服务器访问,其余时候不转发的效果。这个时候问题就比较多:1.落地服务器可以也用hy2还是只能搭建socks5 ;2.单独配置nekoray里节点的出站json能不能达到效果;3.看hy2官方文档,要配置hy2服务端的acl和出站规则,实在看不明白。询问了很多人,结果都不会。有大佬能详细讲讲吗,十分感谢

caco12138 avatar Dec 15 '23 07:12 caco12138

acl:
  inline: 
   - proxy(geosite:paypal)
   - proxy(geosite:netflix)
 outbounds:
  - name: final 
    type: direct
  - name: proxy
    type: socks5
    socks5:
      addr: shady.proxy.ru:1080
      username:  xx
      password:  xx

只能http和socks5出站,配置教程已经写的很详细了。

uhgdk avatar Dec 15 '23 14:12 uhgdk

acl:
  inline: 
   - proxy(geosite:paypal)
   - proxy(geosite:netflix)
 outbounds:
  - name: final 
    type: direct
  - name: proxy
    type: socks5
    socks5:
      addr: shady.proxy.ru:1080
      username:  xx
      password:  xx

只能http和socks5出站,配置教程已经写的很详细了。

好的,我试着手动搭建一下,十分感谢

caco12138 avatar Dec 15 '23 15:12 caco12138

我在修改了/etc/hysteria/config.yaml后,重启了hy2服务,但是直接无法正常上网了,nekoray或者v2rayn都是一样的情况。还原配置后可以正常使用。socks5使用x-ui搭建。all_proxy=socks5h://用户名:密码@ip:443 curl -v https://cloudflare.com/cdn-cgi/trace这段代码也能成功运行

 listen: :443
 tls:
   cert: /etc/hysteria/cert.crt
   key: /etc/hysteria/private.key
 quic:
   initStreamReceiveWindow: 
   maxStreamReceiveWindow: 
   initConnReceiveWindow: 
   maxConnReceiveWindow: 
 
 auth:
   type: password
   password: 
 
 masquerade:
   type: proxy
   proxy:
     url: https://xxxxxxx
     rewriteHost: true

 outbounds:
   - name: final 
     type: direct
   - name: some_proxy
     type: socks5
     socks5:
       addr:xxx.xx.xx.xxx:443
       username:xxxxxxxxx
       password:xxxxxxxx

  acl:
   inline: 
    - some_proxy(geosite:paypal)
    - some_proxy(geosite:netflix)
    - direct(all)

caco12138 avatar Dec 16 '23 10:12 caco12138

注意缩进位,acl和outbounds是同一位置,另外我没有写- direct(all)这条。

addr:xxx.xx.xx.xxx:443
username:xxxxxxxxx
password:xxxxxxxx

:后有空格

uhgdk avatar Dec 16 '23 10:12 uhgdk

注意缩进位,acl和outbounds是同一位置,另外我没有写- direct(all)这条。

addr:xxx.xx.xx.xxx:443
username:xxxxxxxxx
password:xxxxxxxx

:后有空格

感谢,已经成功了

caco12138 avatar Dec 16 '23 12:12 caco12138

这个例子很实用 特别是没有软路由的情况下HY2可以使用acl实现分流

Peter-Wuhoo avatar Jan 23 '24 02:01 Peter-Wuhoo

acl:
  inline: 
   - proxy(geosite:paypal)
   - proxy(geosite:netflix)
 outbounds:
  - name: final 
    type: direct
  - name: proxy
    type: socks5
    socks5:
      addr: shady.proxy.ru:1080
      username:  xx
      password:  xx

只能http和socks5出站,配置教程已经写的很详细了。

我就是这样配置的,但是奈飞还是没走socks5代理;outbounds只留proxy才会走socks5代理,但是会全局走socks5代理。

soapmancn avatar Jan 26 '24 12:01 soapmancn

Make sure there are no extra spaces after the addr, username, and password fields in the socks5 outbound configuration.

us254 avatar Mar 20 '24 21:03 us254

我也是同样的问题,如果server配置项中outbound有其他内容,则后面的proxy就失效了,非内容编排原因导致。 注:2024年6月3日安装的最新版本

另外,尝试修改outbound的顺序,感觉整个访问都会走第一个outbound配置。

harrisonyao avatar Jun 03 '24 17:06 harrisonyao