feat: inbound support Hysteria2

This commit is contained in:
wwqgtxx
2023-09-21 14:52:26 +08:00
parent 6c3b973748
commit 233eeb0b38
8 changed files with 315 additions and 6 deletions

View File

@@ -126,14 +126,14 @@ func safeConnClose(c net.Conn, err error) {
var rateStringRegexp = regexp.MustCompile(`^(\d+)\s*([KMGT]?)([Bb])ps$`)
func stringToBps(s string) uint64 {
func StringToBps(s string) uint64 {
if s == "" {
return 0
}
// when have not unit, use Mbps
if v, err := strconv.Atoi(s); err == nil {
return stringToBps(fmt.Sprintf("%d Mbps", v))
return StringToBps(fmt.Sprintf("%d Mbps", v))
}
m := rateStringRegexp.FindStringSubmatch(s)