mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
ws protocol: remove glob exports; adjust dependent crates
This commit is contained in:
parent
27ecccd984
commit
0dae7fd533
10 changed files with 46 additions and 17 deletions
|
|
@ -3,7 +3,7 @@ use std::{net::IpAddr, sync::Arc};
|
|||
use aquatic_common::access_list::AccessListArcSwap;
|
||||
|
||||
pub use aquatic_common::ValidUntil;
|
||||
use aquatic_ws_protocol::{InfoHash, PeerId};
|
||||
use aquatic_ws_protocol::common::{InfoHash, PeerId};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum IpVersion {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ use anyhow::Context;
|
|||
use aquatic_common::access_list::{create_access_list_cache, AccessListArcSwap, AccessListCache};
|
||||
use aquatic_common::rustls_config::RustlsConfig;
|
||||
use aquatic_common::ServerStartInstant;
|
||||
use aquatic_ws_protocol::*;
|
||||
use aquatic_ws_protocol::common::{InfoHash, PeerId, ScrapeAction};
|
||||
use aquatic_ws_protocol::incoming::{
|
||||
AnnounceEvent, AnnounceRequest, InMessage, ScrapeRequest, ScrapeRequestInfoHashes,
|
||||
};
|
||||
use aquatic_ws_protocol::outgoing::{
|
||||
ErrorResponse, ErrorResponseAction, OutMessage, ScrapeResponse, ScrapeStatistics,
|
||||
};
|
||||
use arc_swap::ArcSwap;
|
||||
use async_tungstenite::WebSocketStream;
|
||||
use futures::stream::{SplitSink, SplitStream};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ use anyhow::Context;
|
|||
use aquatic_common::privileges::PrivilegeDropper;
|
||||
use aquatic_common::rustls_config::RustlsConfig;
|
||||
use aquatic_common::{PanicSentinel, ServerStartInstant};
|
||||
use aquatic_ws_protocol::*;
|
||||
use aquatic_ws_protocol::common::InfoHash;
|
||||
use aquatic_ws_protocol::incoming::InMessage;
|
||||
use aquatic_ws_protocol::outgoing::OutMessage;
|
||||
use arc_swap::ArcSwap;
|
||||
use futures::StreamExt;
|
||||
use glommio::channels::channel_mesh::{MeshBuilder, Partial, Role};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ use std::cell::RefCell;
|
|||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
|
||||
use aquatic_ws_protocol::incoming::InMessage;
|
||||
use aquatic_ws_protocol::outgoing::OutMessage;
|
||||
use futures::StreamExt;
|
||||
use glommio::channels::channel_mesh::{MeshBuilder, Partial, Role, Senders};
|
||||
use glommio::enclose;
|
||||
|
|
@ -12,7 +14,6 @@ use glommio::timer::TimerActionRepeat;
|
|||
use rand::{rngs::SmallRng, SeedableRng};
|
||||
|
||||
use aquatic_common::{PanicSentinel, ServerStartInstant};
|
||||
use aquatic_ws_protocol::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::config::Config;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use aquatic_common::access_list::{create_access_list_cache, AccessListArcSwap, AccessListCache};
|
||||
use aquatic_ws_protocol::incoming::{AnnounceEvent, AnnounceRequest, ScrapeRequest};
|
||||
use aquatic_ws_protocol::outgoing::{
|
||||
AnnounceResponse, AnswerOutMessage, ErrorResponse, ErrorResponseAction, OfferOutMessage,
|
||||
OutMessage, ScrapeResponse, ScrapeStatistics,
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
use metrics::Gauge;
|
||||
use rand::rngs::SmallRng;
|
||||
|
|
@ -8,7 +13,7 @@ use rand::rngs::SmallRng;
|
|||
use aquatic_common::{
|
||||
extract_response_peers, IndexMap, SecondsSinceServerStart, ServerStartInstant,
|
||||
};
|
||||
use aquatic_ws_protocol::*;
|
||||
use aquatic_ws_protocol::common::*;
|
||||
|
||||
use crate::common::*;
|
||||
use crate::config::Config;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use std::sync::{atomic::AtomicUsize, Arc};
|
||||
|
||||
use aquatic_ws_protocol::common::InfoHash;
|
||||
use rand_distr::Gamma;
|
||||
|
||||
pub use aquatic_ws_protocol::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Statistics {
|
||||
pub requests: AtomicUsize,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::time::{Duration, Instant};
|
|||
|
||||
use aquatic_common::cpu_pinning::glommio::{get_worker_placement, set_affinity_for_util_worker};
|
||||
use aquatic_common::cpu_pinning::WorkerIndex;
|
||||
use aquatic_ws_protocol::common::InfoHash;
|
||||
use glommio::LocalExecutorBuilder;
|
||||
use rand::prelude::*;
|
||||
use rand_distr::Gamma;
|
||||
|
|
|
|||
|
|
@ -6,10 +6,16 @@ use std::{
|
|||
time::Duration,
|
||||
};
|
||||
|
||||
use aquatic_ws_protocol::incoming::{
|
||||
AnnounceEvent, AnnounceRequest, AnnounceRequestOffer, InMessage, ScrapeRequestInfoHashes,
|
||||
};
|
||||
use aquatic_ws_protocol::outgoing::OutMessage;
|
||||
use aquatic_ws_protocol::{
|
||||
AnnounceAction, AnnounceEvent, AnnounceRequest, AnnounceRequestOffer, InMessage, InfoHash,
|
||||
OfferId, OutMessage, PeerId, RtcAnswer, RtcAnswerType, RtcOffer, RtcOfferType, ScrapeAction,
|
||||
ScrapeRequest, ScrapeRequestInfoHashes,
|
||||
common::{
|
||||
AnnounceAction, InfoHash, OfferId, PeerId, RtcAnswer, RtcAnswerType, RtcOffer,
|
||||
RtcOfferType, ScrapeAction,
|
||||
},
|
||||
incoming::ScrapeRequest,
|
||||
};
|
||||
use async_tungstenite::{client_async, WebSocketStream};
|
||||
use futures::{SinkExt, StreamExt};
|
||||
|
|
@ -168,7 +174,7 @@ impl Connection {
|
|||
}),
|
||||
event: None,
|
||||
offers: None,
|
||||
action: aquatic_ws_protocol::AnnounceAction::Announce,
|
||||
action: AnnounceAction::Announce,
|
||||
peer_id: self.peer_id,
|
||||
bytes_left: Some(bytes_left),
|
||||
numwant: Some(0),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use std::time::Duration;
|
||||
|
||||
use aquatic_ws_protocol::*;
|
||||
use aquatic_ws_protocol::{
|
||||
common::*,
|
||||
incoming::{AnnounceEvent, AnnounceRequest, AnnounceRequestOffer, InMessage},
|
||||
};
|
||||
|
||||
pub fn bench(c: &mut Criterion) {
|
||||
let info_hash = InfoHash([
|
||||
|
|
|
|||
|
|
@ -14,16 +14,22 @@ pub mod common;
|
|||
pub mod incoming;
|
||||
pub mod outgoing;
|
||||
|
||||
pub use common::*;
|
||||
pub use incoming::*;
|
||||
pub use outgoing::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use quickcheck::Arbitrary;
|
||||
use quickcheck_macros::quickcheck;
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
common::*,
|
||||
incoming::{
|
||||
AnnounceEvent, AnnounceRequest, AnnounceRequestOffer, InMessage, ScrapeRequest,
|
||||
ScrapeRequestInfoHashes,
|
||||
},
|
||||
outgoing::{
|
||||
AnnounceResponse, AnswerOutMessage, OfferOutMessage, OutMessage, ScrapeResponse,
|
||||
ScrapeStatistics,
|
||||
},
|
||||
};
|
||||
|
||||
fn arbitrary_20_bytes(g: &mut quickcheck::Gen) -> [u8; 20] {
|
||||
let mut bytes = [0u8; 20];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue