refactor(client): upgrade socket2 to 0.6 and use version-specific API
This commit is contained in:
1 parent
453a63b368
commit
40bc934976
3 files changed
+8
-8
No files matched your search
Generated
+3
-3
@@ -316,12 +316,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.5.10"
|
version = "0.6.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ categories = ["network-programming"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
irtt-proto.workspace = true
|
irtt-proto.workspace = true
|
||||||
libc = { version = "0.2", optional = true }
|
libc = { version = "0.2", optional = true }
|
||||||
socket2 = { version = "0.5", features = ["all"] }
|
socket2 = { version = "0.6", features = ["all"] }
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ pub(crate) fn socket_ttl(socket: &UdpSocket, remote: SocketAddr) -> Result<u32,
|
|||||||
|
|
||||||
fn set_socket_ttl(socket: &UdpSocket, remote: SocketAddr, ttl: u32) -> io::Result<()> {
|
fn set_socket_ttl(socket: &UdpSocket, remote: SocketAddr, ttl: u32) -> io::Result<()> {
|
||||||
if remote.is_ipv4() {
|
if remote.is_ipv4() {
|
||||||
socket2::SockRef::from(socket).set_ttl(ttl)
|
socket2::SockRef::from(socket).set_ttl_v4(ttl)
|
||||||
} else {
|
} else {
|
||||||
socket2::SockRef::from(socket).set_unicast_hops_v6(ttl)
|
socket2::SockRef::from(socket).set_unicast_hops_v6(ttl)
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ fn set_socket_ttl(socket: &UdpSocket, remote: SocketAddr, ttl: u32) -> io::Resul
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn get_socket_ttl(socket: &UdpSocket, remote: SocketAddr) -> io::Result<u32> {
|
fn get_socket_ttl(socket: &UdpSocket, remote: SocketAddr) -> io::Result<u32> {
|
||||||
if remote.is_ipv4() {
|
if remote.is_ipv4() {
|
||||||
socket2::SockRef::from(socket).ttl()
|
socket2::SockRef::from(socket).ttl_v4()
|
||||||
} else {
|
} else {
|
||||||
socket2::SockRef::from(socket).unicast_hops_v6()
|
socket2::SockRef::from(socket).unicast_hops_v6()
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ fn set_socket_traffic_class_io(
|
|||||||
target_os = "haiku",
|
target_os = "haiku",
|
||||||
)))]
|
)))]
|
||||||
fn set_ipv4_traffic_class(socket: &UdpSocket, traffic_class: u32) -> io::Result<()> {
|
fn set_ipv4_traffic_class(socket: &UdpSocket, traffic_class: u32) -> io::Result<()> {
|
||||||
socket2::SockRef::from(socket).set_tos(traffic_class)
|
socket2::SockRef::from(socket).set_tos_v4(traffic_class)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
@@ -212,7 +212,7 @@ fn unsupported_traffic_class(traffic_class: u32, feature: &'static str) -> io::R
|
|||||||
))
|
))
|
||||||
))]
|
))]
|
||||||
fn get_ipv4_traffic_class(socket: &UdpSocket) -> io::Result<u32> {
|
fn get_ipv4_traffic_class(socket: &UdpSocket) -> io::Result<u32> {
|
||||||
socket2::SockRef::from(socket).tos()
|
socket2::SockRef::from(socket).tos_v4()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
|
|||||||
Reference in new issue
Block a user