Bladeren bron

Check "serverNames" and "shortIds" (client side)

Prevents https://github.com/XTLS/Xray-core/issues/1675
RPRX 2 jaren geleden
bovenliggende
commit
9d3de59d3f
1 gewijzigde bestanden met toevoegingen van 6 en 0 verwijderingen
  1. 6 0
      infra/conf/transport_internet.go

+ 6 - 0
infra/conf/transport_internet.go

@@ -631,12 +631,18 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
 		if config.Fingerprint == "hellogolang" {
 		if config.Fingerprint == "hellogolang" {
 			return nil, newError(`invalid "fingerprint": `, config.Fingerprint)
 			return nil, newError(`invalid "fingerprint": `, config.Fingerprint)
 		}
 		}
+		if len(c.ServerNames) != 0 {
+			return nil, newError(`non-empty "serverNames", please use "serverName" instead`)
+		}
 		if c.PublicKey == "" {
 		if c.PublicKey == "" {
 			return nil, newError(`empty "publicKey"`)
 			return nil, newError(`empty "publicKey"`)
 		}
 		}
 		if config.PublicKey, err = base64.RawURLEncoding.DecodeString(c.PublicKey); err != nil || len(config.PublicKey) != 32 {
 		if config.PublicKey, err = base64.RawURLEncoding.DecodeString(c.PublicKey); err != nil || len(config.PublicKey) != 32 {
 			return nil, newError(`invalid "publicKey": `, c.PublicKey)
 			return nil, newError(`invalid "publicKey": `, c.PublicKey)
 		}
 		}
+		if len(c.ShortIds) != 0 {
+			return nil, newError(`non-empty "shortIds", please use "shortId" instead`)
+		}
 		config.ShortId = make([]byte, 8)
 		config.ShortId = make([]byte, 8)
 		if _, err = hex.Decode(config.ShortId, []byte(c.ShortId)); err != nil {
 		if _, err = hex.Decode(config.ShortId, []byte(c.ShortId)); err != nil {
 			return nil, newError(`invalid "shortId": `, c.ShortId)
 			return nil, newError(`invalid "shortId": `, c.ShortId)