mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
support vless for sing
This commit is contained in:
@@ -2,5 +2,4 @@
|
||||
|
||||
package imports
|
||||
|
||||
// not yet tested
|
||||
import _ "github.com/InazumaV/V2bX/core/hy"
|
||||
|
||||
@@ -46,7 +46,6 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
}
|
||||
switch info.Type {
|
||||
case "v2ray":
|
||||
in.Type = "vmess"
|
||||
t := option.V2RayTransportOptions{
|
||||
Type: info.Network,
|
||||
}
|
||||
@@ -83,10 +82,20 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
||||
return option.Inbound{}, fmt.Errorf("decode NetworkSettings error: %s", err)
|
||||
}
|
||||
}
|
||||
in.VMessOptions = option.VMessInboundOptions{
|
||||
ListenOptions: listen,
|
||||
TLS: &tls,
|
||||
Transport: &t,
|
||||
if info.ExtraConfig.EnableVless == "true" {
|
||||
in.Type = "vless"
|
||||
in.VLESSOptions = option.VLESSInboundOptions{
|
||||
ListenOptions: listen,
|
||||
TLS: &tls,
|
||||
Transport: &t,
|
||||
}
|
||||
} else {
|
||||
in.Type = "vmess"
|
||||
in.VMessOptions = option.VMessInboundOptions{
|
||||
ListenOptions: listen,
|
||||
TLS: &tls,
|
||||
Transport: &t,
|
||||
}
|
||||
}
|
||||
case "shadowsocks":
|
||||
in.Type = "shadowsocks"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user