Fix xtoken length (#105)

* Allow user defined TlsConfig

Let user deifne custom TlsConfig.

* Remove failing x-token lengths

X-Tokens can be different lengths so we should just check that it's longer than 0.
This commit is contained in:
Linus Kendall 2023-04-10 10:44:56 +02:00 committed by GitHub
parent fc3f82ac04
commit 802236793c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -21,8 +21,6 @@ use {
},
};
pub const XTOKEN_LENGTH: usize = 28;
#[derive(Debug, thiserror::Error)]
pub enum GeyserGrpcClientError {
#[error("Invalid URI: {0}")]
@ -69,7 +67,7 @@ impl GeyserGrpcClient<()> {
None => None,
};
match x_token {
Some(token) if token.len() != XTOKEN_LENGTH => {
Some(token) if token.len() < 1 => {
return Err(GeyserGrpcClientError::InvalidXTokenLength(token.len()));
}
_ => {}
@ -144,7 +142,7 @@ mod tests {
#[tokio::test]
async fn test_channel_invalid_token_some() {
let endpoint = "http://127.0.0.1:10000";
let x_token = "123";
let x_token = "";
let res = GeyserGrpcClient::connect(endpoint, Some(x_token), None);
assert!(matches!(
res,