mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-01-22 18:08:14 -05:00
fix bug for reality dest
This commit is contained in:
parent
ebe176b7b3
commit
62d2805906
@ -1 +1,8 @@
|
|||||||
package conf
|
package conf
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestConf_LoadFromPath(t *testing.T) {
|
||||||
|
c := New()
|
||||||
|
t.Log(c.LoadFromPath("../example/config.yml.example"))
|
||||||
|
}
|
||||||
|
18
conf/node.go
18
conf/node.go
@ -1,7 +1,5 @@
|
|||||||
package conf
|
package conf
|
||||||
|
|
||||||
import "github.com/goccy/go-json"
|
|
||||||
|
|
||||||
type NodeConfig struct {
|
type NodeConfig struct {
|
||||||
ApiConfig *ApiConfig `yaml:"ApiConfig"`
|
ApiConfig *ApiConfig `yaml:"ApiConfig"`
|
||||||
ControllerConfig *ControllerConfig `yaml:"ControllerConfig"`
|
ControllerConfig *ControllerConfig `yaml:"ControllerConfig"`
|
||||||
@ -95,12 +93,12 @@ type CertConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RealityConfig struct {
|
type RealityConfig struct {
|
||||||
Dest json.RawMessage `yaml:"Dest"`
|
Dest interface{} `yaml:"Dest"`
|
||||||
Xver uint64 `yaml:"Xver"`
|
Xver uint64 `yaml:"Xver"`
|
||||||
ServerNames []string `yaml:"ServerNames"`
|
ServerNames []string `yaml:"ServerNames"`
|
||||||
PrivateKey string `yaml:"PrivateKey"`
|
PrivateKey string `yaml:"PrivateKey"`
|
||||||
MinClientVer string `yaml:"MinClientVer"`
|
MinClientVer string `yaml:"MinClientVer"`
|
||||||
MaxClientVer string `yaml:"MaxClientVer"`
|
MaxClientVer string `yaml:"MaxClientVer"`
|
||||||
MaxTimeDiff uint64 `yaml:"MaxTimeDiff"`
|
MaxTimeDiff uint64 `yaml:"MaxTimeDiff"`
|
||||||
ShortIds []string `yaml:"ShortIds"`
|
ShortIds []string `yaml:"ShortIds"`
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ Nodes:
|
|||||||
EnableReality: false # Enable reality
|
EnableReality: false # Enable reality
|
||||||
RealityConfig: # This config like RealityObject for xray-core, please check https://xtls.github.io/config/transport.html#realityobject
|
RealityConfig: # This config like RealityObject for xray-core, please check https://xtls.github.io/config/transport.html#realityobject
|
||||||
Dest: 80 # Same fallback dest
|
Dest: 80 # Same fallback dest
|
||||||
Xver: "example.com:443" # Same fallback xver
|
Xver: 0 # Same fallback xver
|
||||||
ServerNames:
|
ServerNames:
|
||||||
- "example.com"
|
- "example.com"
|
||||||
- "www.example.com"
|
- "www.example.com"
|
||||||
|
@ -86,8 +86,12 @@ func BuildInbound(config *conf.ControllerConfig, nodeInfo *panel.NodeInfo, tag s
|
|||||||
} else if config.EnableReality {
|
} else if config.EnableReality {
|
||||||
// Reality
|
// Reality
|
||||||
inbound.StreamSetting.Security = "reality"
|
inbound.StreamSetting.Security = "reality"
|
||||||
|
d, err := json.Marshal(config.RealityConfig.Dest)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("marshal reality dest error: %s", err)
|
||||||
|
}
|
||||||
inbound.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
inbound.StreamSetting.REALITYSettings = &coreConf.REALITYConfig{
|
||||||
Dest: config.RealityConfig.Dest,
|
Dest: d,
|
||||||
Xver: config.RealityConfig.Xver,
|
Xver: config.RealityConfig.Xver,
|
||||||
ServerNames: config.RealityConfig.ServerNames,
|
ServerNames: config.RealityConfig.ServerNames,
|
||||||
PrivateKey: config.RealityConfig.PrivateKey,
|
PrivateKey: config.RealityConfig.PrivateKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user