support hysteria for sing, remove hy core

This commit is contained in:
yuzuki999
2023-08-08 18:24:10 +08:00
parent 9495913f26
commit 69aed47086
17 changed files with 32 additions and 844 deletions

View File

@@ -226,6 +226,15 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
in.TrojanOptions.FallbackForALPN = fallbackForALPN
}
}
case "hysteria":
in.Type = "hysteria"
in.HysteriaOptions = option.HysteriaInboundOptions{
ListenOptions: listen,
UpMbps: info.UpMbps,
DownMbps: info.DownMbps,
Obfs: info.HyObfs,
TLS: &tls,
}
}
return in, nil
}

View File

@@ -265,5 +265,7 @@ func (b *Box) Protocols() []string {
return []string{
"v2ray",
"shadowsocks",
"trojan",
"hysteria",
}
}

View File

@@ -59,6 +59,15 @@ func (b *Box) AddUsers(p *core.AddUsersParams) (added int, err error) {
}
}
err = b.inbounds[p.Tag].(*inbound.Trojan).AddUsers(us)
case "hysteria":
us := make([]option.HysteriaUser, len(p.UserInfo))
for i := range p.UserInfo {
us[i] = option.HysteriaUser{
Name: p.UserInfo[i].Uuid,
AuthString: p.UserInfo[i].Uuid,
}
}
err = b.inbounds[p.Tag].(*inbound.Hysteria).AddUsers(us)
}
if err != nil {
return 0, err
@@ -91,6 +100,10 @@ func (b *Box) DelUsers(users []panel.UserInfo, tag string) error {
del = i.(*inbound.VMess)
case "shadowsocks":
del = i.(*inbound.ShadowsocksMulti)
case "trojan":
del = i.(*inbound.Trojan)
case "hysteria":
del = i.(*inbound.Hysteria)
}
} else {
return errors.New("the inbound not found")