diff --git a/core/xray/inbound.go b/core/xray/inbound.go index 6198c96..c59c5f7 100644 --- a/core/xray/inbound.go +++ b/core/xray/inbound.go @@ -6,7 +6,6 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/Yuzuki616/V2bX/api/panel" "github.com/Yuzuki616/V2bX/conf" "github.com/goccy/go-json" @@ -102,24 +101,24 @@ func buildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s RejectUnknownSNI: config.CertConfig.RejectUnknownSni, } } - } - // use remote reality replace local config - if nodeInfo.ExtraConfig.EnableReality { - rc := nodeInfo.ExtraConfig.RealityConfig - in.StreamSetting.Security = "reality" - d, err := json.Marshal(rc.Dest) - if err != nil { - return nil, fmt.Errorf("marshal reality dest error: %s", err) - } - in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{ - Dest: d, - Xver: rc.Xver, - ServerNames: rc.ServerNames, - PrivateKey: rc.PrivateKey, - MinClientVer: rc.MinClientVer, - MaxClientVer: rc.MaxClientVer, - MaxTimeDiff: rc.MaxTimeDiff, - ShortIds: rc.ShortIds, + // use remote reality replace local config + if nodeInfo.ExtraConfig.EnableReality { + rc := nodeInfo.ExtraConfig.RealityConfig + in.StreamSetting.Security = "reality" + d, err := json.Marshal(rc.Dest) + if err != nil { + return nil, fmt.Errorf("marshal reality dest error: %s", err) + } + in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{ + Dest: d, + Xver: rc.Xver, + ServerNames: rc.ServerNames, + PrivateKey: rc.PrivateKey, + MinClientVer: rc.MinClientVer, + MaxClientVer: rc.MaxClientVer, + MaxTimeDiff: rc.MaxTimeDiff, + ShortIds: rc.ShortIds, + } } } // Support ProxyProtocol for any transport protocol @@ -194,6 +193,8 @@ func buildV2ray(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, inbound if err != nil { return fmt.Errorf("unmarshal grpc settings error: %s", err) } + default: + return errors.New("the network type is not vail") } return nil } diff --git a/core/xray/user.go b/core/xray/user.go index 26dc933..3eb9341 100644 --- a/core/xray/user.go +++ b/core/xray/user.go @@ -77,12 +77,14 @@ func (c *Core) AddUsers(p *vCore.AddUsersParams) (added int, err error) { p.NodeInfo.ExtraConfig.EnableVless { if p.Config.XrayOptions.VlessFlow != "" { if p.Config.XrayOptions.VlessFlow == p.NodeInfo.ExtraConfig.VlessFlow { + // local users = buildVlessUsers(p.Tag, p.UserInfo, p.Config.XrayOptions.VlessFlow) } else { + // remote users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow) } - } else { + // remote users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow) } } else { diff --git a/node/cert.go b/node/cert.go index 500c631..ed79016 100644 --- a/node/cert.go +++ b/node/cert.go @@ -21,13 +21,17 @@ func (c *Controller) renewCertTask() { } func (c *Controller) requestCert() error { - if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" { - return fmt.Errorf("cert file path or key file path not exist") - } switch c.CertConfig.CertMode { case "reality", "none", "": return nil + case "file": + if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" { + return fmt.Errorf("cert file path or key file path not exist") + } case "dns", "http": + if c.CertConfig.CertFile == "" || c.CertConfig.KeyFile == "" { + return fmt.Errorf("cert file path or key file path not exist") + } if file.IsExist(c.CertConfig.CertFile) && file.IsExist(c.CertConfig.KeyFile) { return nil }