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

build: MSRV 1.85 / edition 2024 #134

Merged
merged 2 commits into from
Mar 6, 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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "vproxy"
version = "2.0.60"
edition = "2021"
authors = ["[email protected]"]
description = "A high-performance HTTP/HTTPS/SOCKS5 proxy server"
repository = "https://github.com/0x676e67/vproxy"
keywords = ["http", "https", "socks5", "proxy", "server"]
readme = "README.md"
license = "GPL-3.0"
rust-version = "1.84"
edition = "2024"
rust-version = "1.85"

[dependencies]
base64 = "0.22.0"
Expand Down
6 changes: 3 additions & 3 deletions src/connect.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::{extension::Extension, http::error::Error};
use cidr::{IpCidr, Ipv4Cidr, Ipv6Cidr};
use http::{uri::Authority, Request, Response};
use http::{Request, Response, uri::Authority};
use hyper::body::Incoming;
use hyper_util::{
client::legacy::{connect, Client},
client::legacy::{Client, connect},
rt::{TokioExecutor, TokioTimer},
};
use rand::random;
Expand All @@ -12,7 +12,7 @@ use std::{
time::Duration,
};
use tokio::{
net::{lookup_host, TcpSocket, TcpStream, UdpSocket},
net::{TcpSocket, TcpStream, UdpSocket, lookup_host},
time::timeout,
};

Expand Down
2 changes: 1 addition & 1 deletion src/daemon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{serve, BootArgs, BIN_NAME};
use crate::{BIN_NAME, BootArgs, serve};
use daemonize::Daemonize;
use nix::sys::signal;
use nix::unistd::{Pid, Uid, User};
Expand Down
4 changes: 2 additions & 2 deletions src/http/genca.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::BIN_NAME;
use rcgen::{
date_time_ymd, BasicConstraints, CertificateParams, DistinguishedName, DnType, IsCa, KeyPair,
KeyUsagePurpose, SanType,
BasicConstraints, CertificateParams, DistinguishedName, DnType, IsCa, KeyPair, KeyUsagePurpose,
SanType, date_time_ymd,
};

/// Get self-signed certificate and key.
Expand Down
10 changes: 5 additions & 5 deletions src/http/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use auth::Authenticator;
use http::uri::Authority;
use tracing::{instrument, Level};
use tracing::{Level, instrument};

use super::accept::Accept;
use super::error::Error;
Expand All @@ -11,9 +11,9 @@ use crate::serve::{Context, Serve};
use crate::{connect::Connector, extension::Extension};
use bytes::Bytes;
use http::StatusCode;
use http_body_util::{combinators::BoxBody, BodyExt, Empty, Full};
use http_body_util::{BodyExt, Empty, Full, combinators::BoxBody};
use hyper::service::service_fn;
use hyper::{body::Incoming, upgrade::Upgraded, Method, Request, Response};
use hyper::{Method, Request, Response, body::Incoming, upgrade::Upgraded};
use hyper_util::{
rt::{TokioExecutor, TokioIo},
server::conn::auto::Builder,
Expand Down Expand Up @@ -303,11 +303,11 @@ fn full<T: Into<Bytes>>(chunk: T) -> BoxBody<Bytes, hyper::Error> {
}

mod auth {
use super::{empty, Error};
use super::{Error, empty};
use crate::extension::Extension;
use base64::Engine;
use bytes::Bytes;
use http::{header, HeaderMap, Response, StatusCode};
use http::{HeaderMap, Response, StatusCode, header};
use http_body_util::combinators::BoxBody;

impl TryInto<Response<BoxBody<Bytes, hyper::Error>>> for Error {
Expand Down
6 changes: 3 additions & 3 deletions src/http/tls/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use std::{
task::{Context, Poll},
};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::{timeout, Timeout};
use tokio_rustls::{server::TlsStream, Accept, TlsAcceptor};
use tokio::time::{Timeout, timeout};
use tokio_rustls::{Accept, TlsAcceptor, server::TlsStream};

pin_project! {
/// Future type for [`RustlsAcceptor`](crate::tls_rustls::RustlsAcceptor).
Expand Down Expand Up @@ -99,7 +99,7 @@ where
}
Poll::Ready(Ok(Err(e))) => return Poll::Ready(Err(e)),
Poll::Ready(Err(timeout)) => {
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)))
return Poll::Ready(Err(Error::new(ErrorKind::TimedOut, timeout)));
}
Poll::Pending => return Poll::Pending,
},
Expand Down
4 changes: 2 additions & 2 deletions src/route.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use cidr::IpCidr;
use futures::TryStreamExt;
use netlink_packet_route::{
route::{RouteAddress, RouteAttribute, RouteProtocol, RouteScope, RouteType},
AddressFamily,
route::{RouteAddress, RouteAttribute, RouteProtocol, RouteScope, RouteType},
};
use rtnetlink::{new_connection, Error, Handle, IpVersion};
use rtnetlink::{Error, Handle, IpVersion, new_connection};
use sysctl::{Sysctl, SysctlError};

/// Attempts to add a route to the given subnet on the loopback interface.
Expand Down
2 changes: 1 addition & 1 deletion src/serve.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
AuthMode, BootArgs, Proxy, Result,
connect::Connector,
http::{HttpServer, HttpsServer},
socks::Socks5Server,
AuthMode, BootArgs, Proxy, Result,
};
use std::net::SocketAddr;
use tracing_subscriber::{EnvFilter, FmtSubscriber};
Expand Down
2 changes: 1 addition & 1 deletion src/socks/proto/handshake/password/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct UsernamePassword {

impl std::fmt::Display for UsernamePassword {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use percent_encoding::{NON_ALPHANUMERIC, percent_encode};
match (self.username.is_empty(), self.password.is_empty()) {
(true, true) => write!(f, ""),
(true, false) => write!(
Expand Down
2 changes: 1 addition & 1 deletion src/socks/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod udp;
pub use self::{
address::Address,
command::Command,
handshake::{password::UsernamePassword, Method},
handshake::{Method, password::UsernamePassword},
reply::Reply,
request::Request,
response::Response,
Expand Down
2 changes: 1 addition & 1 deletion src/socks/server/auth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
extension::Extension,
socks::proto::{handshake::password, AsyncStreamOperation, Method, UsernamePassword},
socks::proto::{AsyncStreamOperation, Method, UsernamePassword, handshake::password},
};
use password::{Request, Response, Status::*};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion src/socks/server/connection/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::{
use tokio::{
io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf},
net::{
tcp::{ReadHalf, WriteHalf},
TcpStream,
tcp::{ReadHalf, WriteHalf},
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/socks/server/connection/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::{
use tokio::{
io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf},
net::{
tcp::{OwnedReadHalf, OwnedWriteHalf, ReadHalf, WriteHalf},
TcpStream,
tcp::{OwnedReadHalf, OwnedWriteHalf, ReadHalf, WriteHalf},
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/socks/server/connection/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use self::{associate::UdpAssociate, bind::Bind, connect::Connect};
use super::{super::error::Error, auth::Auth};
use crate::socks::{
proto::{self, handshake, Address, AsyncStreamOperation, Command, Method},
proto::{self, Address, AsyncStreamOperation, Command, Method, handshake},
server::AuthAdaptor,
};
use std::{net::SocketAddr, sync::Arc, time::Duration};
Expand Down
4 changes: 2 additions & 2 deletions src/socks/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::{
};
pub use crate::socks::server::{
auth::AuthAdaptor,
connection::{associate::UdpAssociate, ClientConnection, IncomingConnection},
connection::{ClientConnection, IncomingConnection, associate::UdpAssociate},
};
use crate::{
connect::Connector,
Expand All @@ -27,7 +27,7 @@ use crate::{
};

use tokio::{io::AsyncWriteExt, net::UdpSocket, sync::RwLock};
use tracing::{instrument, Level};
use tracing::{Level, instrument};

pub struct Socks5Server {
listener: TcpListener,
Expand Down
Loading