Skip to content

Commit abcb56b

Browse files
committed
rust edition 2024
1 parent cbc0104 commit abcb56b

File tree

15 files changed

+20
-24
lines changed

15 files changed

+20
-24
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ authors = ["ssrlive <[email protected]>"]
55
description = "Fundamental abstractions and async read / write functions for SOCKS5 protocol and Relatively low-level asynchronized SOCKS5 server implementation based on tokio"
66
categories = ["network-programming", "asynchronous"]
77
keywords = ["socks5", "socks", "proxy", "async", "network"]
8-
edition = "2021"
8+
edition = "2024"
99
readme = "README.md"
1010
license = "GPL-3.0-or-later"
1111
repository = "https://github.com/ssrlive/socks5-impl"
1212

1313
[features]
14-
# default = ["serde", "client", "server", "tokio"]
14+
default = ["serde", "client", "server", "tokio"]
1515
client = ["tokio"]
1616
serde = ["dep:serde"]
1717
server = ["tokio"]

examples/demo-client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use socks5_impl::{client, Result};
1+
use socks5_impl::{Result, client};
22
use tokio::io::{AsyncReadExt, AsyncWriteExt, BufStream};
33
use tokio::net::TcpStream;
44

examples/demo-server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use socks5_impl::protocol::{handshake, Address, AsyncStreamOperation, AuthMethod, Reply, Request, Response};
1+
use socks5_impl::protocol::{Address, AsyncStreamOperation, AuthMethod, Reply, Request, Response, handshake};
22
use std::io;
33
use tokio::{io::AsyncWriteExt, net::TcpListener};
44

examples/dns-query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod util;
22

33
use hickory_proto::rr::record_type::RecordType;
4-
use socks5_impl::{client, protocol::UserKey, Result};
4+
use socks5_impl::{Result, client, protocol::UserKey};
55
use std::{net::SocketAddr, time::Duration};
66
use tokio::{
77
io::{AsyncReadExt, AsyncWriteExt},

examples/s5-server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use socks5_impl::{
2-
protocol::{Address, Reply, UdpHeader},
3-
server::{auth, connection::associate, AssociatedUdpSocket, ClientConnection, IncomingConnection, Server, UdpAssociate},
42
Error, Result,
3+
protocol::{Address, Reply, UdpHeader},
4+
server::{AssociatedUdpSocket, ClientConnection, IncomingConnection, Server, UdpAssociate, auth, connection::associate},
55
};
66
use std::{
77
net::{SocketAddr, ToSocketAddrs},
8-
sync::{atomic::AtomicBool, Arc},
8+
sync::{Arc, atomic::AtomicBool},
99
};
1010
use tokio::{
1111
io,

examples/udp-client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use socks5_impl::{client::UdpClientImpl, protocol::UserKey, Result};
1+
use socks5_impl::{Result, client::UdpClientImpl, protocol::UserKey};
22
use std::{
33
net::{SocketAddr, ToSocketAddrs},
44
time::Duration,

examples/util/dns.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![allow(dead_code)]
22

33
use hickory_proto::{
4-
op::{header::MessageType, op_code::OpCode, query::Query, Message, ResponseCode},
5-
rr::{record_type::RecordType, Name, RData},
4+
op::{Message, ResponseCode, header::MessageType, op_code::OpCode, query::Query},
5+
rr::{Name, RData, record_type::RecordType},
66
};
77
use std::{net::IpAddr, str::FromStr};
88

src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ impl UdpClientImpl<SocksUdpClient> {
490490
#[cfg(test)]
491491
mod tests {
492492
use crate::{
493+
Error, Result,
493494
client::{self, SocksListener, SocksUdpClient, UdpClientTrait},
494495
protocol::{Address, UserKey},
495-
Error, Result,
496496
};
497497
use async_trait::async_trait;
498498
use std::{

src/protocol/handshake/password_method/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct UserKey {
1818

1919
impl std::fmt::Display for UserKey {
2020
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21-
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
21+
use percent_encoding::{NON_ALPHANUMERIC, percent_encode};
2222
match (self.username.is_empty(), self.password.is_empty()) {
2323
(true, true) => write!(f, ""),
2424
(true, false) => write!(f, ":{}", percent_encode(self.password.as_bytes(), NON_ALPHANUMERIC)),

src/protocol/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub use self::{
1010
address::{Address, AddressType},
1111
command::Command,
1212
handshake::{
13-
password_method::{self, UserKey},
1413
AuthMethod,
14+
password_method::{self, UserKey},
1515
},
1616
reply::Reply,
1717
request::Request,

0 commit comments

Comments
 (0)