Skip to content

Commit

Permalink
fix(shadowsocks): Report error on iPSK error
Browse files Browse the repository at this point in the history
- fix #1770
  • Loading branch information
zonyitoo committed Nov 16, 2024
1 parent c85a741 commit 9a6f40f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/shadowsocks/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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));
}
}
}
Expand Down

0 comments on commit 9a6f40f

Please sign in to comment.