mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
fix cert mode
This commit is contained in:
parent
a9319e2732
commit
b3a8b27c2f
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Yuzuki616/V2bX/api/panel"
|
"github.com/Yuzuki616/V2bX/api/panel"
|
||||||
"github.com/Yuzuki616/V2bX/conf"
|
"github.com/Yuzuki616/V2bX/conf"
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
@ -102,24 +101,24 @@ func buildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
|
|||||||
RejectUnknownSNI: config.CertConfig.RejectUnknownSni,
|
RejectUnknownSNI: config.CertConfig.RejectUnknownSni,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// use remote reality replace local config
|
||||||
// use remote reality replace local config
|
if nodeInfo.ExtraConfig.EnableReality {
|
||||||
if nodeInfo.ExtraConfig.EnableReality {
|
rc := nodeInfo.ExtraConfig.RealityConfig
|
||||||
rc := nodeInfo.ExtraConfig.RealityConfig
|
in.StreamSetting.Security = "reality"
|
||||||
in.StreamSetting.Security = "reality"
|
d, err := json.Marshal(rc.Dest)
|
||||||
d, err := json.Marshal(rc.Dest)
|
if err != nil {
|
||||||
if err != nil {
|
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
||||||
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
}
|
||||||
}
|
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
||||||
in.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
Dest: d,
|
||||||
Dest: d,
|
Xver: rc.Xver,
|
||||||
Xver: rc.Xver,
|
ServerNames: rc.ServerNames,
|
||||||
ServerNames: rc.ServerNames,
|
PrivateKey: rc.PrivateKey,
|
||||||
PrivateKey: rc.PrivateKey,
|
MinClientVer: rc.MinClientVer,
|
||||||
MinClientVer: rc.MinClientVer,
|
MaxClientVer: rc.MaxClientVer,
|
||||||
MaxClientVer: rc.MaxClientVer,
|
MaxTimeDiff: rc.MaxTimeDiff,
|
||||||
MaxTimeDiff: rc.MaxTimeDiff,
|
ShortIds: rc.ShortIds,
|
||||||
ShortIds: rc.ShortIds,
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Support ProxyProtocol for any transport protocol
|
// Support ProxyProtocol for any transport protocol
|
||||||
@ -194,6 +193,8 @@ func buildV2ray(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, inbound
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
return errors.New("the network type is not vail")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -77,12 +77,14 @@ func (c *Core) AddUsers(p *vCore.AddUsersParams) (added int, err error) {
|
|||||||
p.NodeInfo.ExtraConfig.EnableVless {
|
p.NodeInfo.ExtraConfig.EnableVless {
|
||||||
if p.Config.XrayOptions.VlessFlow != "" {
|
if p.Config.XrayOptions.VlessFlow != "" {
|
||||||
if p.Config.XrayOptions.VlessFlow == p.NodeInfo.ExtraConfig.VlessFlow {
|
if p.Config.XrayOptions.VlessFlow == p.NodeInfo.ExtraConfig.VlessFlow {
|
||||||
|
// local
|
||||||
users = buildVlessUsers(p.Tag, p.UserInfo, p.Config.XrayOptions.VlessFlow)
|
users = buildVlessUsers(p.Tag, p.UserInfo, p.Config.XrayOptions.VlessFlow)
|
||||||
} else {
|
} else {
|
||||||
|
// remote
|
||||||
users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// remote
|
||||||
users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
users = buildVlessUsers(p.Tag, p.UserInfo, p.NodeInfo.ExtraConfig.VlessFlow)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
10
node/cert.go
10
node/cert.go
@ -21,13 +21,17 @@ func (c *Controller) renewCertTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) requestCert() error {
|
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 {
|
switch c.CertConfig.CertMode {
|
||||||
case "reality", "none", "":
|
case "reality", "none", "":
|
||||||
return nil
|
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":
|
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) {
|
if file.IsExist(c.CertConfig.CertFile) && file.IsExist(c.CertConfig.KeyFile) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user