Skip to content

Commit

Permalink
REALITY config: Add target as an alias of dest
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Oct 5, 2024
1 parent c7534c4 commit 75729ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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
Expand Down Expand Up @@ -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`)
Expand Down

0 comments on commit 75729ce

Please sign in to comment.