Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ redundant_imports = "warn"
redundant_lifetimes = "warn"
trivial_numeric_casts = "warn"
unit_bindings = "warn"
unreachable_pub = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly,fuzzing)'] }
unused_import_braces = "warn"
unused_lifetimes = "warn"
Expand Down Expand Up @@ -111,6 +112,7 @@ precedence_bits = "warn"
pub_without_shorthand = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_pub_crate = "allow" # Conflicts with `unreachable_pub` (rust lint), which we prefer.
redundant_test_prefix = "warn"
redundant_type_annotations = "warn"
ref_patterns = "warn"
Expand Down
3 changes: 2 additions & 1 deletion mtu/src/bsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use static_assertions::{const_assert, const_assert_eq};
)]
#[expect(
non_camel_case_types,
unreachable_pub,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::struct_field_names,
Expand Down Expand Up @@ -381,7 +382,7 @@ fn if_index_mtu(remote: IpAddr) -> Result<(u16, Option<usize>)> {
}
}

pub fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
pub(crate) fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
let (if_index, mtu1) = if_index_mtu(remote)?;
let (if_name, mtu2) = if_name_mtu(if_index.into())?;
Ok((if_name, mtu1.or(mtu2).ok_or_else(default_err)?))
Expand Down
2 changes: 1 addition & 1 deletion mtu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const fn aligned_by(size: usize, align: usize) -> usize {
//
// See <https://github.com/mozilla/mtu/issues/82>.
#[cfg(any(target_os = "ios", target_os = "tvos", target_os = "visionos"))]
pub fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
pub(crate) fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
return Err(default_err());
}

Expand Down
3 changes: 2 additions & 1 deletion mtu/src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::{aligned_by, default_err, routesocket::RouteSocket, unlikely_err};

#[expect(
non_camel_case_types,
unreachable_pub,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::struct_field_names,
Expand Down Expand Up @@ -347,7 +348,7 @@ fn if_name_mtu(if_index: i32, fd: &mut RouteSocket) -> Result<(String, usize)> {
Err(default_err())
}

pub fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
pub(crate) fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
// Create a netlink socket.
let mut fd = RouteSocket::new(AF_NETLINK, NETLINK_ROUTE)?;
let if_index = if_index(remote, &mut fd)?;
Expand Down
6 changes: 3 additions & 3 deletions mtu/src/routesocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ type RouteSocketSeq = i32;

static SEQ: AtomicRouteSocketSeq = AtomicRouteSocketSeq::new(0);

pub struct RouteSocket(OwnedFd);
pub(crate) struct RouteSocket(OwnedFd);

impl RouteSocket {
pub fn new(domain: libc::c_int, protocol: libc::c_int) -> Result<Self> {
pub(crate) fn new(domain: libc::c_int, protocol: libc::c_int) -> Result<Self> {
let fd = unsafe { socket(domain, SOCK_RAW, protocol) };
if fd == -1 {
return Err(Error::last_os_error());
}
Ok(Self(unsafe { OwnedFd::from_raw_fd(fd) }))
}

pub fn new_seq() -> RouteSocketSeq {
pub(crate) fn new_seq() -> RouteSocketSeq {
SEQ.fetch_add(1, Ordering::Relaxed)
}
}
Expand Down
2 changes: 1 addition & 1 deletion mtu/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Drop for MibTablePtr {
}
}

pub fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
pub(crate) fn interface_and_mtu_impl(remote: IpAddr) -> Result<(String, usize)> {
// Convert remote to Windows SOCKADDR_INET format. The SOCKADDR_INET union contains an IPv4 or
// an IPv6 address.
//
Expand Down
6 changes: 3 additions & 3 deletions neqo-bin/src/client/http09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_hash::FxHashMap as HashMap;
use super::{Args, CloseState, Res, get_output_file, qlog_new};
use crate::{STREAM_IO_BUFFER_SIZE, now};

pub struct Handler<'a> {
pub(super) struct Handler<'a> {
streams: HashMap<StreamId, Option<BufWriter<File>>>,
url_queue: VecDeque<Url>,
handled_urls: Vec<Url>,
Expand Down Expand Up @@ -125,7 +125,7 @@ impl super::Handler for Handler<'_> {
}
}

pub fn create_client(
pub(super) fn create_client(
args: &Args,
local_addr: SocketAddr,
remote_addr: SocketAddr,
Expand Down Expand Up @@ -229,7 +229,7 @@ impl super::Client for Connection {
}

impl<'b> Handler<'b> {
pub fn new(url_queue: VecDeque<Url>, args: &'b Args) -> Self {
pub(super) fn new(url_queue: VecDeque<Url>, args: &'b Args) -> Self {
Self {
streams: HashMap::default(),
url_queue,
Expand Down
4 changes: 2 additions & 2 deletions neqo-bin/src/client/http3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
send_data::{SendData, SendResult},
};

pub struct Handler {
pub(super) struct Handler {
#[expect(clippy::struct_field_names, reason = "This name is more descriptive.")]
url_handler: UrlHandler,
token: Option<ResumptionToken>,
Expand Down Expand Up @@ -63,7 +63,7 @@ impl Handler {
}
}

pub fn create_client(
pub(super) fn create_client(
args: &Args,
local_addr: SocketAddr,
remote_addr: SocketAddr,
Expand Down
10 changes: 5 additions & 5 deletions neqo-bin/src/send_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{borrow::Cow, cmp::min};
use crate::STREAM_IO_BUFFER_SIZE;

#[derive(Debug, Default)]
pub struct SendData {
pub(crate) struct SendData {
data: Cow<'static, [u8]>,
offset: usize,
remaining: usize,
Expand Down Expand Up @@ -41,7 +41,7 @@ impl From<&str> for SendData {
}

impl SendData {
pub const fn zeroes(total: usize) -> Self {
pub(crate) const fn zeroes(total: usize) -> Self {
const MESSAGE: &[u8] = &[0; STREAM_IO_BUFFER_SIZE];
Self {
data: Cow::Borrowed(MESSAGE),
Expand All @@ -60,7 +60,7 @@ impl SendData {
/// Returns `SendResult::Done` if all data was sent, `SendResult::MoreData` if
/// more data remains, or `SendResult::StreamClosed` if the stream was closed
/// (e.g., by `STOP_SENDING`).
pub fn send<F, E>(&mut self, mut f: F) -> SendResult
pub(crate) fn send<F, E>(&mut self, mut f: F) -> SendResult
where
F: FnMut(&[u8]) -> Result<usize, E>,
{
Expand All @@ -77,14 +77,14 @@ impl SendData {
SendResult::Done
}

pub const fn len(&self) -> usize {
pub(crate) const fn len(&self) -> usize {
self.total
}
}

/// Result of a graceful send operation.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SendResult {
pub(crate) enum SendResult {
/// All data was sent successfully.
Done,
/// More data remains to be sent (stream buffer full).
Expand Down
10 changes: 5 additions & 5 deletions neqo-common/src/hrtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod mac {

#[repr(C)]
#[derive(Debug, Copy, Clone, Default)]
pub struct thread_time_constraint_policy {
pub(super) struct thread_time_constraint_policy {
period: u32,
computation: u32,
constraint: u32,
Expand Down Expand Up @@ -157,7 +157,7 @@ mod mac {
}

/// Set a thread time policy.
pub fn set_thread_policy(mut policy: thread_time_constraint_policy) {
pub(super) fn set_thread_policy(mut policy: thread_time_constraint_policy) {
_ = unsafe {
thread_policy_set(
pthread_mach_thread_np(pthread_self()),
Expand All @@ -168,7 +168,7 @@ mod mac {
};
}

pub fn get_scale() -> f64 {
pub(super) fn get_scale() -> f64 {
const NANOS_PER_MSEC: f64 = 1_000_000.0;
let mut timebase_info = mach_timebase_info_data_t::default();
unsafe {
Expand All @@ -178,7 +178,7 @@ mod mac {
}

/// Create a realtime policy and set it.
pub fn set_realtime(base: f64) {
pub(super) fn set_realtime(base: f64) {
#[expect(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
Expand All @@ -194,7 +194,7 @@ mod mac {
}

/// Get the default policy.
pub fn get_default_policy() -> thread_time_constraint_policy {
pub(super) fn get_default_policy() -> thread_time_constraint_policy {
let mut policy = thread_time_constraint_policy::default();
let mut count = THREAD_TIME_CONSTRAINT_POLICY_COUNT;
let mut get_default = 0;
Expand Down
2 changes: 1 addition & 1 deletion neqo-common/src/incrdecoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod tests {
}

impl UintTestCase {
pub fn run(&self) {
pub(crate) fn run(&self) {
eprintln!(
"IncrementalDecoderUint decoder with {:?} ; expect {:?}",
self.b, self.v
Expand Down
4 changes: 2 additions & 2 deletions neqo-http3/benches/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const RTT: Duration = Duration::from_millis(10);
const BENCHMARK_PARAMS: [(usize, usize); 3] = [(1, 1_000), (1_000, 1), (1_000, 1_000)];

/// Creates a ready simulator for benchmarking HTTP/3 streams.
pub fn setup(streams: usize, data_size: usize) -> ReadySimulator {
pub(crate) fn setup(streams: usize, data_size: usize) -> ReadySimulator {
let nodes = boxed![
Node::default_client(boxed![Requests::new(streams, data_size)]),
TailDrop::dsl_uplink(),
Expand All @@ -38,7 +38,7 @@ pub fn setup(streams: usize, data_size: usize) -> ReadySimulator {
///
/// The closure receives the benchmark group and parameters, allowing each
/// benchmark to define its own measurement approach.
pub fn benchmark<M>(c: &mut Criterion, mut measure: M)
pub(crate) fn benchmark<M>(c: &mut Criterion, mut measure: M)
where
M: FnMut(&mut BenchmarkGroup<'_, criterion::measurement::WallTime>, usize, usize),
{
Expand Down
Loading
Loading