mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
测试:尝试增加hysteria2协议,尝试增加设备数限制功能
This commit is contained in:
@@ -200,6 +200,22 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
Obfs: info.Hysteria.Obfs,
|
||||
TLS: &tls,
|
||||
}
|
||||
case "hysteria2":
|
||||
in.Type = "hysteria2"
|
||||
var obfs *option.Hysteria2Obfs
|
||||
if info.Hysteria2.ObfsType != "" {
|
||||
obfs = &option.Hysteria2Obfs{
|
||||
Type: info.Hysteria2.ObfsType,
|
||||
Password: info.Hysteria2.ObfsPassword,
|
||||
}
|
||||
}
|
||||
in.Hysteria2Options = option.Hysteria2InboundOptions{
|
||||
ListenOptions: listen,
|
||||
UpMbps: info.Hysteria2.UpMbps,
|
||||
DownMbps: info.Hysteria2.DownMbps,
|
||||
Obfs: obfs,
|
||||
TLS: &tls,
|
||||
}
|
||||
}
|
||||
return in, nil
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ func (b *Sing) Protocols() []string {
|
||||
"shadowsocks",
|
||||
"trojan",
|
||||
"hysteria",
|
||||
"hysteria2",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,16 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
||||
AuthString: p.Users[i].Uuid,
|
||||
}
|
||||
}
|
||||
err = b.inbounds[p.Tag].(*inbound.HysteriaM).AddUsers(us)
|
||||
err = b.inbounds[p.Tag].(*inbound.Hysteria).AddUsers(us)
|
||||
case "hysteria2":
|
||||
us := make([]option.Hysteria2User, len(p.Users))
|
||||
for i := range p.Users {
|
||||
us[i] = option.Hysteria2User{
|
||||
Name: p.Users[i].Uuid,
|
||||
Password: p.Users[i].Uuid,
|
||||
}
|
||||
}
|
||||
err = b.inbounds[p.Tag].(*inbound.Hysteria2).AddUsers(us)
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -105,7 +114,9 @@ func (b *Sing) DelUsers(users []panel.UserInfo, tag string) error {
|
||||
case "trojan":
|
||||
del = i.(*inbound.Trojan)
|
||||
case "hysteria":
|
||||
del = i.(*inbound.HysteriaM)
|
||||
del = i.(*inbound.Hysteria)
|
||||
case "hysteria2":
|
||||
del = i.(*inbound.Hysteria2)
|
||||
}
|
||||
} else {
|
||||
return errors.New("the inbound not found")
|
||||
|
||||
Reference in New Issue
Block a user