diff --git a/adapter/outbound/hysteria.go b/adapter/outbound/hysteria.go index ff6e5deb..e30565fb 100644 --- a/adapter/outbound/hysteria.go +++ b/adapter/outbound/hysteria.go @@ -11,7 +11,6 @@ import ( "net" "net/netip" "os" - "regexp" "strconv" "time" @@ -43,8 +42,6 @@ const ( DefaultHopInterval = 10 ) -var rateStringRegexp = regexp.MustCompile(`^(\d+)\s*([KMGT]?)([Bb])ps$`) - type Hysteria struct { *Base diff --git a/adapter/outbound/util.go b/adapter/outbound/util.go index 3faa3c43..4b59183e 100644 --- a/adapter/outbound/util.go +++ b/adapter/outbound/util.go @@ -7,6 +7,7 @@ import ( "fmt" "net" "net/netip" + "regexp" "strconv" "sync" @@ -123,6 +124,8 @@ func safeConnClose(c net.Conn, err error) { } } +var rateStringRegexp = regexp.MustCompile(`^(\d+)\s*([KMGT]?)([Bb])ps$`) + func stringToBps(s string) uint64 { if s == "" { return 0 diff --git a/docs/config.yaml b/docs/config.yaml index 274eaedd..c2bdc263 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -642,6 +642,25 @@ proxies: # socks5 # fingerprint: xxxx # fast-open: true # 支持 TCP 快速打开,默认为 false + #hysteria2 + - name: "hysteria2" + type: hysteria2 + server: server.com + port: 443 + # up和down均不写或为0则使用BBR流控 + # up: "30 Mbps" # 若不写单位,默认为 Mbps + # down: "200 Mbps" # 若不写单位,默认为 Mbps + password: yourpassword + # obfs: salamander # 默认为空,如果填写则开启obfs,目前仅支持salamander + # obfs-password: yourpassword + # sni: server.com + # skip-cert-verify: false + # fingerprint: xxxx + # alpn: + # - h3 + # ca: "./my.ca" + # ca-str: "xyz" + # wireguard - name: "wg" type: wireguard