Skip to content
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

[auto] Update Rust toolchain to 1.85.0 #160

Merged
merged 4 commits into from
Feb 21, 2025
Merged
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
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ members = [
"lightway-server",
]

resolver = "2"
resolver = "3"

[profile.release]
lto = true
debug = 1

[workspace.package]
repository = "https://github.com/expressvpn/lightway"
edition = "2024"
authors = ["lightway-developers@expressvpn.com"]
license = "AGPL-3.0-only"

[workspace.lints.rust]
unsafe_code = "deny"
unsafe_op_in_unsafe_fn = "deny"
Expand Down
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG --global debian = bookworm
IMPORT github.com/earthly/lib/rust:a49d2a0f4028cd15666d19904f8fc5fbd0b9ba87 AS lib-rust

install-build-dependencies:
FROM rust:1.84.1-$debian
FROM rust:1.85.0-$debian
WORKDIR /lightway
RUN dpkg --add-architecture arm64
RUN apt-get update -qq
Expand Down
8 changes: 4 additions & 4 deletions lightway-app-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "lightway-app-utils"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/expressvpn/lightway"
authors = ["lightway-developers@expressvpn.com"]
license = "AGPL-3.0-only"
repository.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion lightway-app-utils/examples/udprelay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use self::channel::Channel;
use lightway_app_utils::IOUring;

use anyhow::Result;
use async_channel::{bounded, Receiver, Sender};
use async_channel::{Receiver, Sender, bounded};
use bytes::BytesMut;
use clap::Parser;
use lightway_core::IOCallbackResult;
Expand Down
2 changes: 1 addition & 1 deletion lightway-app-utils/src/args/duration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use serde_with::{DisplayFromStr, serde_as};

/// Wrapper for compatibility with both clap and twelf at the same time
#[serde_as]
Expand Down
14 changes: 5 additions & 9 deletions lightway-app-utils/src/iouring.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use anyhow::{anyhow, Context, Result};
use anyhow::{Context, Result, anyhow};
use bytes::{BufMut, Bytes, BytesMut};
use lightway_core::IOCallbackResult;
use thiserror::Error;

use crate::metrics;
use io_uring::{
cqueue::Entry as CEntry, opcode, squeue::Entry as SEntry, types::Fixed, Builder, IoUring,
SubmissionQueue, Submitter,
Builder, IoUring, SubmissionQueue, Submitter, cqueue::Entry as CEntry, opcode,
squeue::Entry as SEntry, types::Fixed,
};
use std::{
os::fd::{AsRawFd, RawFd},
Expand All @@ -16,7 +16,7 @@ use std::{
};
use tokio::{
io::AsyncReadExt,
sync::{mpsc, Mutex},
sync::{Mutex, mpsc},
};
use tokio_eventfd::EventFd;

Expand Down Expand Up @@ -124,11 +124,7 @@ enum SlotIdx {
impl SlotIdx {
fn from_user_data(u: u64) -> Self {
let u = u as isize;
if u < 0 {
Self::Rx(!u)
} else {
Self::Tx(u)
}
if u < 0 { Self::Rx(!u) } else { Self::Tx(u) }
}

fn idx(&self) -> usize {
Expand Down
4 changes: 2 additions & 2 deletions lightway-app-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod tun;

#[cfg(feature = "tokio")]
pub use connection_ticker::{
connection_ticker_cb, ConnectionTicker, ConnectionTickerState, ConnectionTickerTask, Tickable,
ConnectionTicker, ConnectionTickerState, ConnectionTickerTask, Tickable, connection_ticker_cb,
};
#[cfg(feature = "tokio")]
pub use dplpmtud_timer::{DplpmtudTimer, DplpmtudTimerTask};
Expand All @@ -33,4 +33,4 @@ pub use tun::{Tun, TunConfig, TunDirect};
#[cfg(feature = "io-uring")]
mod metrics;
mod utils;
pub use utils::{validate_configuration_file_path, Validate};
pub use utils::{Validate, validate_configuration_file_path};
2 changes: 1 addition & 1 deletion lightway-app-utils/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use metrics::{counter, Counter};
use metrics::{Counter, counter};
use std::sync::LazyLock;

static METRIC_TUN_IOURING_RX_ERR: LazyLock<Counter> =
Expand Down
8 changes: 4 additions & 4 deletions lightway-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "lightway-client"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/expressvpn/lightway"
authors = ["lightway-developers@expressvpn.com"]
license = "AGPL-3.0-only"
repository.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion lightway-client/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use bytesize::ByteSize;
use clap::Parser;
use lightway_app_utils::args::{Cipher, ConnectionType, Duration, LogLevel};
Expand Down
6 changes: 3 additions & 3 deletions lightway-client/src/io/inside/tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use pnet::packet::ipv4::Ipv4Packet;

use lightway_app_utils::{Tun as AppUtilsTun, TunConfig};
use lightway_core::{
ipv4_update_destination, ipv4_update_source, IOCallbackResult, InsideIOSendCallback,
InsideIpConfig,
IOCallbackResult, InsideIOSendCallback, InsideIpConfig, ipv4_update_destination,
ipv4_update_source,
};

use crate::{io::inside::InsideIO, ConnectionState};
use crate::{ConnectionState, io::inside::InsideIO};

pub struct Tun {
tun: AppUtilsTun,
Expand Down
2 changes: 1 addition & 1 deletion lightway-client/src/io/outside/udp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use async_trait::async_trait;
use std::{net::SocketAddr, sync::Arc};
use tokio::net::UdpSocket;
Expand Down
2 changes: 1 addition & 1 deletion lightway-client/src/keepalive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ mod tests {
use more_asserts::*;
use std::collections::VecDeque;
use test_case::test_case;
use tokio::sync::{mpsc, oneshot, Mutex as TokioMutex};
use tokio::sync::{Mutex as TokioMutex, mpsc, oneshot};

#[derive(Copy, Clone, Debug)]
enum FixtureEvent {
Expand Down
16 changes: 8 additions & 8 deletions lightway-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ mod debug;
pub mod io;
pub mod keepalive;

use anyhow::{anyhow, Context, Result};
use anyhow::{Context, Result, anyhow};
use bytes::BytesMut;
use bytesize::ByteSize;
use futures::future::OptionFuture;
use keepalive::Keepalive;
use lightway_app_utils::{
args::Cipher, connection_ticker_cb, ConnectionTicker, ConnectionTickerState, DplpmtudTimer,
EventStream, EventStreamCallback, TunConfig,
ConnectionTicker, ConnectionTickerState, DplpmtudTimer, EventStream, EventStreamCallback,
TunConfig, args::Cipher, connection_ticker_cb,
};
use lightway_core::{
ipv4_update_destination, ipv4_update_source, BuilderPredicates, ClientContextBuilder,
ClientIpConfig, Connection, ConnectionError, ConnectionType, Event, EventCallback,
IOCallbackResult, InsideIpConfig, OutsidePacket, State,
BuilderPredicates, ClientContextBuilder, ClientIpConfig, Connection, ConnectionError,
ConnectionType, Event, EventCallback, IOCallbackResult, InsideIpConfig, OutsidePacket, State,
ipv4_update_destination, ipv4_update_source,
};

// re-export so client app does not need to depend on lightway-core
#[cfg(feature = "debug")]
pub use lightway_core::enable_tls_debug;
pub use lightway_core::{
AuthMethod, PluginFactoryError, PluginFactoryList, RootCertificate, Version, MAX_INSIDE_MTU,
MAX_OUTSIDE_MTU,
AuthMethod, MAX_INSIDE_MTU, MAX_OUTSIDE_MTU, PluginFactoryError, PluginFactoryList,
RootCertificate, Version,
};
use pnet::packet::ipv4::Ipv4Packet;

Expand Down
4 changes: 2 additions & 2 deletions lightway-client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::path::PathBuf;

use anyhow::{anyhow, Context, Result};
use anyhow::{Context, Result, anyhow};
use clap::CommandFactory;
use lightway_core::{Event, EventCallback};
use twelf::Layer;

use lightway_app_utils::{
args::ConnectionType, validate_configuration_file_path, TunConfig, Validate,
TunConfig, Validate, args::ConnectionType, validate_configuration_file_path,
};
use lightway_client::*;

Expand Down
8 changes: 4 additions & 4 deletions lightway-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "lightway-core"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/expressvpn/lightway"
authors = ["lightway-developers@expressvpn.com"]
license = "AGPL-3.0-only"
repository.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
6 changes: 3 additions & 3 deletions lightway-core/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name = "lightway-core-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
authors = ["lightway-developers@expressvpn.com"]
license = "GPL-2.0-only"
edition.workspace = true
authors.workspace = true
license.workspace = true

[package.metadata]
cargo-fuzz = true
Expand Down
12 changes: 2 additions & 10 deletions lightway-core/src/builder_predicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@ pub trait BuilderPredicates: Sized {
where
F: FnOnce(Self) -> Self,
{
if cond {
func(self)
} else {
self
}
if cond { func(self) } else { self }
}

/// When `cond` is True call fallible `func` on `Self`
fn try_when<F>(self, cond: bool, func: F) -> Result<Self, Self::Error>
where
F: FnOnce(Self) -> Result<Self, Self::Error>,
{
if cond {
func(self)
} else {
Ok(self)
}
if cond { func(self) } else { Ok(self) }
}

/// When `maybe` is Some(_) call `func` on `Self` and the contained value
Expand Down
6 changes: 3 additions & 3 deletions lightway-core/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ use wolfssl::{ErrorKind, IOCallbackResult, ProtocolVersion};

use crate::max_dtls_mtu;
use crate::{
ConnectionType, IPV4_HEADER_SIZE, InsideIOSendCallbackArg, PluginResult, SessionId,
TCP_HEADER_SIZE, Version,
context::{ScheduleTickCb, ServerAuthArg, ServerAuthHandle, ServerAuthResult},
metrics,
plugin::PluginList,
utils::tcp_clamp_mss,
wire::{self, AuthMethod},
ConnectionType, InsideIOSendCallbackArg, PluginResult, SessionId, Version, IPV4_HEADER_SIZE,
TCP_HEADER_SIZE,
};

use crate::context::ip_pool::{ClientIpConfigArg, ServerIpPoolArg};
Expand Down Expand Up @@ -936,7 +936,7 @@ impl<AppState: Send> Connection<AppState> {
ref mut pending_session_id,
..
} => {
let new_session_id = rng.lock().unwrap().gen();
let new_session_id = rng.lock().unwrap().r#gen();

self.session.io_cb_mut().set_session_id(new_session_id);

Expand Down
9 changes: 4 additions & 5 deletions lightway-core/src/connection/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ use thiserror::Error;
use wolfssl::Tls13SecretCallbacksArg;

use crate::{
connection::{dplpmtud, fragment_map::FragmentMap, key_update, EventCallbackArg},
AuthMethod, BuilderPredicates, ClientContext, Connection, ConnectionType, MAX_OUTSIDE_MTU,
MIN_OUTSIDE_MTU, OutsideIOSendCallbackArg, ServerContext, ServerIpPoolArg, Version,
connection::{EventCallbackArg, dplpmtud, fragment_map::FragmentMap, key_update},
context::ServerAuthArg,
dtls_required_outside_mtu, max_dtls_outside_mtu,
plugin::PluginFactoryError,
wire::SessionId,
AuthMethod, BuilderPredicates, ClientContext, Connection, ConnectionType,
OutsideIOSendCallbackArg, ServerContext, ServerIpPoolArg, Version, MAX_OUTSIDE_MTU,
MIN_OUTSIDE_MTU,
};

use super::{ConnectionError, ConnectionMode, NewConnectionArgs, PluginList};
Expand Down Expand Up @@ -283,7 +282,7 @@ impl<'a, AppState: Send + 'static> ServerConnectionBuilder<'a, AppState> {
let auth = ctx.auth.clone();
let ip_pool = ctx.ip_pool.clone();

let session_id = ctx.rng.lock().unwrap().gen();
let session_id = ctx.rng.lock().unwrap().r#gen();

let outside_mtu = MAX_OUTSIDE_MTU;
let outside_plugins = ctx.outside_plugins.build()?;
Expand Down
10 changes: 5 additions & 5 deletions lightway-core/src/connection/dplpmtud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::{sync::Arc, time::Duration};

use crate::{wire, IPV4_HEADER_SIZE, MAX_DTLS_HEADER_SIZE, UDP_HEADER_SIZE};
use crate::{IPV4_HEADER_SIZE, MAX_DTLS_HEADER_SIZE, UDP_HEADER_SIZE, wire};

use more_asserts::*;

Expand Down Expand Up @@ -83,11 +83,11 @@ impl ProbeId {
}

fn is_zero(&self) -> bool {
self.0 .0 == 0
self.0.0 == 0
}

fn as_u16(&self) -> u16 {
self.0 .0
self.0.0
}
}

Expand Down Expand Up @@ -121,7 +121,7 @@ impl std::ops::Sub<u16> for ProbeId {

impl std::cmp::PartialEq<u16> for ProbeId {
fn eq(&self, other: &u16) -> bool {
&self.0 .0 == other
&self.0.0 == other
}
}

Expand Down Expand Up @@ -513,7 +513,7 @@ impl<AppState> Dplpmtud<AppState> {

#[cfg(test)]
mod tests {
use crate::{max_dtls_mtu, MAX_OUTSIDE_MTU};
use crate::{MAX_OUTSIDE_MTU, max_dtls_mtu};

use super::*;
use std::sync::Mutex;
Expand Down
4 changes: 2 additions & 2 deletions lightway-core/src/connection/io_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use more_asserts::*;
use wolfssl::IOCallbackResult;

use crate::{
plugin::PluginList, wire, ConnectionType, OutsideIOSendCallbackArg, PluginResult, Version,
ConnectionType, OutsideIOSendCallbackArg, PluginResult, Version, plugin::PluginList, wire,
};

pub(crate) struct SendBuffer {
Expand Down Expand Up @@ -299,7 +299,7 @@ impl wolfssl::IOCallbacks for WolfSSLIOAdapter {
#[cfg(test)]
mod tests {
use super::*;
use crate::{OutsideIOSendCallback, Plugin, SessionId, MAX_OUTSIDE_MTU};
use crate::{MAX_OUTSIDE_MTU, OutsideIOSendCallback, Plugin, SessionId};
use std::{
collections::VecDeque,
io::{Error, ErrorKind},
Expand Down
Loading