mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 09:58:14 -05:00
fix cert mode
This commit is contained in:
parent
a9319e2732
commit
b3a8b27c2f
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
10
node/cert.go
10
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user