mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
commit
e8de084f02
@ -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
|
||||
}
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -15,7 +15,7 @@ require (
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/hashicorp/go-multierror v1.1.1
|
||||
github.com/inazumav/sing-box v0.0.0-20230728123002-eb2ba58e499a
|
||||
github.com/inazumav/sing-box v0.0.0-20230730105931-e8479113c010
|
||||
github.com/juju/ratelimit v1.0.2
|
||||
github.com/oschwald/geoip2-golang v1.9.0
|
||||
github.com/sagernet/sing v0.2.9
|
||||
|
4
go.sum
4
go.sum
@ -379,8 +379,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df h1:MZf03xP9WdakyXhOWuAD5uPK3wHh96wCsqe3hCMKh8E=
|
||||
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4=
|
||||
github.com/inazumav/sing-box v0.0.0-20230728123002-eb2ba58e499a h1:/FGmhOCu6LYt8zd6DpMEvuHlPnUPMr0zziyJkuU1wVI=
|
||||
github.com/inazumav/sing-box v0.0.0-20230728123002-eb2ba58e499a/go.mod h1:W91us/coe3lvl5jCtw2n6acyagpRbOO16h1IV3/0nrc=
|
||||
github.com/inazumav/sing-box v0.0.0-20230730105931-e8479113c010 h1:AbH2HERgLu8Jgi4vHi8aRvkds+biIqxw+Btz3L+XTJY=
|
||||
github.com/inazumav/sing-box v0.0.0-20230730105931-e8479113c010/go.mod h1:W91us/coe3lvl5jCtw2n6acyagpRbOO16h1IV3/0nrc=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
|
Loading…
Reference in New Issue
Block a user