FILE / ScuroNeko/H2Master

app/utils.go

Исходный файл и его история в репозитории.
FILE 992db80ea327517890882867d4c24b826e3e94aa
This repository has been archived on 2026-04-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
H2Master/app/utils.go
T
2026-03-05 12:21:18 +03:00

32 lines
980 B
Go

package app
import (
"fmt"
"net/url"
"strings"
)
type NodeConfigRsp struct {
Config NodeConfig `json:"config"`
HysteriaConfig HysteriaConfig `json:"hysteria"`
}
func buildSubUrl(conf NodeConfig, hystConf HysteriaConfig, key string, user User) string {
values := url.Values{}
values.Add("type", "hysteria")
values.Add("security", "tls")
values.Add("alpn", "h3,h2")
values.Add("fp", "chrome")
values.Add("allowInsecure", "0")
values.Add("sni", conf.SNI)
if hystConf.Obfs != nil {
values.Add("obfs", hystConf.Obfs.Type)
values.Add("obfs-password", hystConf.Obfs.Salamander.Password)
}
host := fmt.Sprintf("%s@%s%s", key, conf.Host, hystConf.Listen)
subName := strings.ReplaceAll(conf.NameFormat, "{username}", user.Username)
return fmt.Sprintf("hysteria2://%s?%s#%s", host, values.Encode(), subName)
// hysteria2://pass@185.231.245.25:51052?&type=hysteria&mport&security=tls&sni=nix13.pw&alpn=h3&fp=chrome&allowInsecure=0#🇷🇺ssia (user1)
}