initial commit

This commit is contained in:
2026-03-05 12:21:18 +03:00
commit 992db80ea3
16 changed files with 623 additions and 0 deletions

31
app/utils.go Normal file
View File

@@ -0,0 +1,31 @@
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)
}