mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-15 01:09:20 +02:00
REALITY config: Add `target` as an alias of `dest`
https://t.me/projectXtls/364
This commit is contained in:
parent
c7534c4e36
commit
75729ce779
|
@ -474,6 +474,7 @@ type REALITYConfig struct {
|
|||
Show bool `json:"show"`
|
||||
MasterKeyLog string `json:"masterKeyLog"`
|
||||
Dest json.RawMessage `json:"dest"`
|
||||
Target json.RawMessage `json:"target"`
|
||||
Type string `json:"type"`
|
||||
Xver uint64 `json:"xver"`
|
||||
ServerNames []string `json:"serverNames"`
|
||||
|
@ -495,6 +496,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
|
|||
config.Show = c.Show
|
||||
config.MasterKeyLog = c.MasterKeyLog
|
||||
var err error
|
||||
if c.Dest == nil {
|
||||
c.Dest = c.Target
|
||||
}
|
||||
if c.Dest != nil {
|
||||
var i uint16
|
||||
var s string
|
||||
|
@ -522,7 +526,7 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
}
|
||||
if c.Type == "" {
|
||||
return nil, errors.New(`please fill in a valid value for "dest"`)
|
||||
return nil, errors.New(`please fill in a valid value for "dest" or "target"`)
|
||||
}
|
||||
if c.Xver > 2 {
|
||||
return nil, errors.New(`invalid PROXY protocol version, "xver" only accepts 0, 1, 2`)
|
||||
|
|
Loading…
Reference in New Issue