Browse Source

Config: Prefer newer alias (REALITY `target`, RAW)

pull/3929/head^2
RPRX 1 month ago committed by GitHub
parent
commit
e4939dc1db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      infra/conf/transport_internet.go

12
infra/conf/transport_internet.go

@ -484,10 +484,10 @@ func (c *TLSConfig) Build() (proto.Message, error) {
} }
type REALITYConfig struct { type REALITYConfig struct {
Show bool `json:"show"`
MasterKeyLog string `json:"masterKeyLog"` MasterKeyLog string `json:"masterKeyLog"`
Dest json.RawMessage `json:"dest"` Show bool `json:"show"`
Target json.RawMessage `json:"target"` Target json.RawMessage `json:"target"`
Dest json.RawMessage `json:"dest"`
Type string `json:"type"` Type string `json:"type"`
Xver uint64 `json:"xver"` Xver uint64 `json:"xver"`
ServerNames []string `json:"serverNames"` ServerNames []string `json:"serverNames"`
@ -506,10 +506,10 @@ type REALITYConfig struct {
func (c *REALITYConfig) Build() (proto.Message, error) { func (c *REALITYConfig) Build() (proto.Message, error) {
config := new(reality.Config) config := new(reality.Config)
config.Show = c.Show
config.MasterKeyLog = c.MasterKeyLog config.MasterKeyLog = c.MasterKeyLog
config.Show = c.Show
var err error var err error
if c.Dest == nil { if c.Target != nil {
c.Dest = c.Target c.Dest = c.Target
} }
if c.Dest != nil { if c.Dest != nil {
@ -539,7 +539,7 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
} }
} }
if c.Type == "" { if c.Type == "" {
return nil, errors.New(`please fill in a valid value for "dest" or "target"`) return nil, errors.New(`please fill in a valid value for "target"`)
} }
if c.Xver > 2 { if c.Xver > 2 {
return nil, errors.New(`invalid PROXY protocol version, "xver" only accepts 0, 1, 2`) return nil, errors.New(`invalid PROXY protocol version, "xver" only accepts 0, 1, 2`)
@ -856,7 +856,7 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
default: default:
return nil, errors.New(`Unknown security "` + c.Security + `".`) return nil, errors.New(`Unknown security "` + c.Security + `".`)
} }
if c.TCPSettings == nil { if c.RAWSettings != nil {
c.TCPSettings = c.RAWSettings c.TCPSettings = c.RAWSettings
} }
if c.TCPSettings != nil { if c.TCPSettings != nil {

Loading…
Cancel
Save