chore: Cleanup REALITY code

This commit is contained in:
H1JK
2023-03-11 12:23:27 +08:00
parent 07f3cd2ae5
commit ae4d114802
3 changed files with 20 additions and 7 deletions

View File

@ -24,8 +24,8 @@ func (o RealityOptions) Parse() (*tlsC.RealityConfig, error) {
return nil, errors.New("invalid REALITY public key")
}
config.ShortID, err = hex.DecodeString(o.ShortID)
if err != nil {
n, err = hex.Decode(config.ShortID[:], []byte(o.ShortID))
if err != nil || n > tlsC.RealityMaxShortIDLen {
return nil, errors.New("invalid REALITY short ID")
}