fix(shadowsocks): Report error on iPSK error

- fix #1770
This commit is contained in:
zonyitoo
2024-11-17 01:22:22 +08:00
parent c85a74194f
commit 9a6f40f80e
+5 -1
View File
@@ -387,6 +387,10 @@ pub enum ServerConfigError {
#[error("invalid key encoding for {0}, {1}")]
InvalidKeyEncoding(CipherKind, base64::DecodeError),
/// Invalid user key encoding
#[error("invalid iPSK encoding for {0}, {1}")]
InvalidUserKeyEncoding(CipherKind, base64::DecodeError),
/// Key length mismatch
#[error("invalid key length for {0}, expecting {1} bytes, but found {2} bytes")]
InvalidKeyLength(CipherKind, usize, usize),
@@ -533,7 +537,7 @@ where
identity_keys.push(Bytes::from(v));
}
Err(err) => {
panic!("iPSK {ipsk} is not base64 encoded, error: {err}");
return Err(ServerConfigError::InvalidUserKeyEncoding(method, err));
}
}
}