mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_http: move protocol module to new crate aquatic_http_protocol
This commit is contained in:
parent
4caf174da5
commit
4ac2012a2a
36 changed files with 65 additions and 24 deletions
21
Cargo.lock
generated
21
Cargo.lock
generated
|
|
@ -75,8 +75,7 @@ dependencies = [
|
|||
"aquatic_cli_helpers",
|
||||
"aquatic_common",
|
||||
"aquatic_common_tcp",
|
||||
"bendy",
|
||||
"criterion",
|
||||
"aquatic_http_protocol",
|
||||
"either",
|
||||
"flume",
|
||||
"hashbrown",
|
||||
|
|
@ -98,6 +97,24 @@ dependencies = [
|
|||
"smartstring",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquatic_http_protocol"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bendy",
|
||||
"criterion",
|
||||
"hashbrown",
|
||||
"itoa",
|
||||
"log",
|
||||
"memchr",
|
||||
"quickcheck",
|
||||
"quickcheck_macros",
|
||||
"rand",
|
||||
"serde",
|
||||
"smartstring",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquatic_udp"
|
||||
version = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ members = [
|
|||
"aquatic_common",
|
||||
"aquatic_common_tcp",
|
||||
"aquatic_http",
|
||||
"aquatic_http_protocol",
|
||||
"aquatic_udp",
|
||||
"aquatic_udp_bench",
|
||||
"aquatic_udp_load_test",
|
||||
|
|
|
|||
|
|
@ -13,22 +13,12 @@ path = "src/lib/lib.rs"
|
|||
name = "aquatic_http"
|
||||
path = "src/bin/main.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "bench_request_from_path"
|
||||
path = "benches/bench_request_from_path.rs"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "bench_announce_response_to_bytes"
|
||||
path = "benches/bench_announce_response_to_bytes.rs"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
aquatic_cli_helpers = { path = "../aquatic_cli_helpers" }
|
||||
aquatic_common = { path = "../aquatic_common" }
|
||||
aquatic_common_tcp = { path = "../aquatic_common_tcp" }
|
||||
bendy = { version = "0.3", features = ["std", "serde"] }
|
||||
aquatic_http_protocol = { path = "../aquatic_http_protocol" }
|
||||
either = "1"
|
||||
flume = "0.7"
|
||||
hashbrown = { version = "0.7", features = ["serde"] }
|
||||
|
|
@ -48,6 +38,5 @@ simplelog = "0.8"
|
|||
smartstring = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
quickcheck = "0.9"
|
||||
quickcheck_macros = "0.9"
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ use smartstring::{SmartString, LazyCompact};
|
|||
|
||||
pub use aquatic_common::{ValidUntil, convert_ipv4_mapped_ipv4};
|
||||
|
||||
use crate::protocol::common::*;
|
||||
use crate::protocol::request::Request;
|
||||
use crate::protocol::response::{Response, ResponsePeer};
|
||||
use aquatic_http_protocol::common::*;
|
||||
use aquatic_http_protocol::request::Request;
|
||||
use aquatic_http_protocol::response::{Response, ResponsePeer};
|
||||
|
||||
|
||||
pub trait Ip: Copy + Eq + ::std::hash::Hash {}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ use parking_lot::MutexGuard;
|
|||
use rand::{Rng, SeedableRng, rngs::SmallRng};
|
||||
|
||||
use aquatic_common::extract_response_peers;
|
||||
use aquatic_http_protocol::request::*;
|
||||
use aquatic_http_protocol::response::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::config::Config;
|
||||
|
||||
use crate::protocol::request::*;
|
||||
use crate::protocol::response::*;
|
||||
|
||||
|
||||
pub fn run_request_worker(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ pub mod common;
|
|||
pub mod config;
|
||||
pub mod handler;
|
||||
pub mod network;
|
||||
pub mod protocol;
|
||||
pub mod tasks;
|
||||
|
||||
use common::*;
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ use mio::net::TcpStream;
|
|||
use native_tls::{TlsAcceptor, MidHandshakeTlsStream};
|
||||
|
||||
use aquatic_common_tcp::network::stream::Stream;
|
||||
use aquatic_http_protocol::request::Request;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::protocol::request::Request;
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ use mio::{Events, Poll, Interest, Token};
|
|||
use mio::net::TcpListener;
|
||||
|
||||
use aquatic_common_tcp::network::utils::create_listener;
|
||||
use aquatic_http_protocol::response::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::config::Config;
|
||||
use crate::protocol::response::*;
|
||||
|
||||
use connection::*;
|
||||
|
||||
|
|
|
|||
35
aquatic_http_protocol/Cargo.toml
Normal file
35
aquatic_http_protocol/Cargo.toml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[package]
|
||||
name = "aquatic_http_protocol"
|
||||
version = "0.1.0"
|
||||
authors = ["Joakim Frostegård <joakim.frostegard@gmail.com>"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
|
||||
[lib]
|
||||
name = "aquatic_http_protocol"
|
||||
|
||||
[[bench]]
|
||||
name = "bench_request_from_path"
|
||||
path = "benches/bench_request_from_path.rs"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "bench_announce_response_to_bytes"
|
||||
path = "benches/bench_announce_response_to_bytes.rs"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
bendy = { version = "0.3", features = ["std", "serde"] }
|
||||
hashbrown = { version = "0.7", features = ["serde"] }
|
||||
itoa = "0.4"
|
||||
log = "0.4"
|
||||
memchr = "2"
|
||||
rand = { version = "0.7", features = ["small_rng"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
smartstring = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
quickcheck = "0.9"
|
||||
quickcheck_macros = "0.9"
|
||||
|
|
@ -3,7 +3,7 @@ use std::time::Duration;
|
|||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
|
||||
use aquatic_http::protocol::response::*;
|
||||
use aquatic_http_protocol::response::*;
|
||||
|
||||
|
||||
pub fn bench(c: &mut Criterion) {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use std::time::Duration;
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
|
||||
use aquatic_http::protocol::request::Request;
|
||||
use aquatic_http_protocol::request::Request;
|
||||
|
||||
|
||||
static INPUT: &str = "/announce?info_hash=%04%0bkV%3f%5cr%14%a6%b7%98%adC%c3%c9.%40%24%00%b9&peer_id=-TR2940-5ert69muw5t8&port=11000&uploaded=0&downloaded=0&left=0&numwant=0&key=3ab4b977&compact=1&supportcrypto=1&event=stopped";
|
||||
Loading…
Add table
Add a link
Reference in a new issue