安装或升级
bash <(curl -fsSL https://get.hy2.sh/)
nano /etc/hysteria/config.yaml
写入配置
listen: :18880
acme:
domains:
- 域名
email: 邮箱
#或者是使用自定义tls证书
tls:
cert: /etc/hysteria/server.crt
key: /etc/hysteria/server.key
auth:
type: password
password: 密码
#可选混淆
obfs:
type: salamander
salamander:
password: 混淆密码
masquerade:
type: proxy
proxy:
url: 伪装网站
rewriteHost: true
ignoreClientBandwidth: false #忽略客户端速率设置,永远使用bbr
quic:
initStreamReceiveWindow: 8388608
maxStreamReceiveWindow: 8388608
initConnReceiveWindow: 20971520
maxConnReceiveWindow: 20971520
maxIdleTimeout: 30s
maxIncomingStreams: 1024
disablePathMTUDiscovery: false
bandwidth:
up: 1 gbps
down: 1 gbps
outbounds:
- name: hoho
type: direct
direct:
mode: 46 // mode项可选优先访问ipv6 mode:64
配置证书
openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /etc/hysteria/server.key -out /etc/hysteria/server.crt -subj "/CN=as.idolmaster-official.jp" -days 36500 && sudo chown hysteria /etc/hysteria/server.key && sudo chown hysteria /etc/hysteria/server.crt
设置端口跳跃
# IPv4
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 18880
# IPv6
ip6tables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 18880