support vless for sing

This commit is contained in:
Yuzuki616
2023-07-30 19:49:42 +08:00
parent f17fd74e86
commit 991b22a317
5 changed files with 38 additions and 18 deletions

View File

@@ -13,16 +13,25 @@ import (
func (b *Box) AddUsers(p *core.AddUsersParams) (added int, err error) {
switch p.NodeInfo.Type {
case "v2ray":
us := make([]option.VMessUser, len(p.UserInfo))
for i := range p.UserInfo {
us[i] = option.VMessUser{
Name: p.UserInfo[i].Uuid,
UUID: p.UserInfo[i].Uuid,
if p.NodeInfo.ExtraConfig.EnableVless == "true" {
us := make([]option.VLESSUser, len(p.UserInfo))
for i := range p.UserInfo {
us[i] = option.VLESSUser{
Name: p.UserInfo[i].Uuid,
Flow: p.NodeInfo.ExtraConfig.VlessFlow,
UUID: p.UserInfo[i].Uuid,
}
}
}
err = b.inbounds[p.Tag].(*inbound.VMess).AddUsers(us)
if err != nil {
return 0, err
err = b.inbounds[p.Tag].(*inbound.VLESS).AddUsers(us)
} else {
us := make([]option.VMessUser, len(p.UserInfo))
for i := range p.UserInfo {
us[i] = option.VMessUser{
Name: p.UserInfo[i].Uuid,
UUID: p.UserInfo[i].Uuid,
}
}
err = b.inbounds[p.Tag].(*inbound.VMess).AddUsers(us)
}
case "shadowsocks":
us := make([]option.ShadowsocksUser, len(p.UserInfo))
@@ -33,6 +42,9 @@ func (b *Box) AddUsers(p *core.AddUsersParams) (added int, err error) {
}
}
}
if err != nil {
return 0, err
}
return len(p.UserInfo), err
}