Skip to content

Try to implement sabr #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Try to implement sabr #335

wants to merge 2 commits into from

Conversation

FireMasterK
Copy link
Member

This doesn't work yet.

use reqwest::{Body, Client, Method, Request, Url};
use serde_json::Value;
use std::error::Error;
use std::str::FromStr;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <unused_imports> reported by reviewdog 🐶
unused import: std::str::FromStr

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_format_id_from_json(item))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_format_id_from_json(item))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

.and_then(|v| v.as_array())
.map(|arr| {
arr.iter()
.filter_map(|item| parse_buffered_range_from_json(item))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::redundant_closure reported by reviewdog 🐶
redundant closure

}

#[derive(Debug, Clone)]
pub struct Sequence {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
multiple fields are never read

}

#[derive(Debug, Clone)]
pub struct InitializedFormat {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
fields format_id, duration_ms, and sequence_count are never read

}

#[derive(Debug, Clone)]
pub struct SabrResponse {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
fields stream_protection_status, sabr_redirect, sabr_error, and next_request_policy are never read

}

#[derive(Debug)]
pub struct UmpPart {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
field size is never read

+ 16 * (byte2 as i32 + 256 * (byte3 as i32 + 256 * byte4 as i32))
}
_ => {
let value = u32::from_le_bytes([data[1], data[2], data[3], data[4]]) as i32;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::let_and_return reported by reviewdog 🐶
returning the result of a let binding from a block

src/main.rs Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} has already been used", fd_pos).as_str())

src/main.rs Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} is not a Unix socket", fd_pos).as_str())

src/main.rs Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} has already been used", fd_pos).as_str())

src/main.rs Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::expect_fun_call reported by reviewdog 🐶
function call inside of expect

.expect(format!("fd {} is not a TCP listener", fd_pos).as_str())

src/main.rs Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::io_other_error reported by reviewdog 🐶
this can be std::io::Error::other(_)

let resp = resp.map_err(|e| io::Error::new(ErrorKind::Other, e));


fn get_client_info_from_query(query: &QString) -> ClientInfo {
// Extract client info from query parameters
let client_name = query.get("c").and_then(|c| match c {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::bind_instead_of_map reported by reviewdog 🐶
using Option.and_then(|x| Some(y)), which is more succinctly expressed as map(|x| y)

pub buffered_ranges: Vec<BufferedRange>,
}

impl SabrRequestBuilder {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] <dead_code> reported by reviewdog 🐶
methods with_resolution, with_visibility, and encode are never used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant