forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.rs
25 lines (20 loc) · 758 Bytes
/
utils.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use bittorrent_udp_tracker_core::statistics;
use futures::future::BoxFuture;
use mockall::mock;
use tokio::sync::broadcast::error::SendError;
pub(crate) fn sample_ipv4_remote_addr() -> SocketAddr {
sample_ipv4_socket_address()
}
pub(crate) fn sample_ipv4_socket_address() -> SocketAddr {
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080)
}
pub(crate) fn sample_issue_time() -> f64 {
1_000_000_000_f64
}
mock! {
pub(crate) UdpCoreStatsEventSender {}
impl statistics::event::sender::Sender for UdpCoreStatsEventSender {
fn send_event(&self, event: statistics::event::Event) -> BoxFuture<'static,Option<Result<usize,SendError<statistics::event::Event> > > > ;
}
}