cippy issue, fmt, update/upgrade

This commit is contained in:
2026-08-16 10:33:28 +02:00
parent b527019b76
commit a66ea31ab3
14 changed files with 301 additions and 133 deletions
Generated
+50 -50
View File
@@ -138,9 +138,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "cc"
version = "1.3.0"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89588d05638b5b4594a3348a2d6c20277e43a7f5c5202b05cc56888475a47b8"
checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -171,9 +171,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.6.4"
version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7"
checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca"
dependencies = [
"clap_builder",
"clap_derive",
@@ -181,9 +181,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.6.2"
version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b"
checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889"
dependencies = [
"anstream",
"anstyle",
@@ -252,9 +252,9 @@ dependencies = [
[[package]]
name = "data-encoding"
version = "2.11.0"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8"
checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
[[package]]
name = "der-parser"
@@ -278,13 +278,13 @@ checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
[[package]]
name = "displaydoc"
version = "0.2.6"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
"syn 3.0.3",
]
[[package]]
@@ -311,9 +311,9 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
[[package]]
name = "foldhash"
@@ -323,21 +323,21 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "futures-core"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
[[package]]
name = "futures-task"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
[[package]]
name = "futures-util"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
dependencies = [
"futures-core",
"futures-task",
@@ -441,9 +441,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.103"
version = "0.3.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"
checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
dependencies = [
"cfg-if",
"futures-util",
@@ -655,9 +655,9 @@ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
[[package]]
name = "num-integer"
version = "0.1.46"
version = "0.1.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
dependencies = [
"num-traits",
]
@@ -716,9 +716,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "portable-atomic"
version = "1.14.0"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
[[package]]
name = "powerfmt"
@@ -836,9 +836,9 @@ dependencies = [
[[package]]
name = "rcgen"
version = "0.14.8"
version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57f6d249aad744e274e682777a50283a225a32705394ee6d5fcc01efa25e4055"
checksum = "091e7a8e7d86e6feb87a27ce8e2cba29d49eff9507afeebefab7eeb2ca667fb4"
dependencies = [
"pem",
"ring",
@@ -888,9 +888,9 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.23.42"
version = "0.23.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"
checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
dependencies = [
"once_cell",
"ring",
@@ -914,9 +914,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
version = "1.15.0"
version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "764899a24af3980067ee14bc143654f297b22eaebfe3c7b6b211920a5a59b046"
checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
dependencies = [
"web-time",
"zeroize",
@@ -951,9 +951,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
[[package]]
name = "rustls-webpki"
version = "0.103.13"
version = "0.103.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a"
dependencies = [
"ring",
"rustls-pki-types",
@@ -1157,18 +1157,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.19"
version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "2.0.19"
version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
dependencies = [
"proc-macro2",
"quote",
@@ -1177,9 +1177,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.54"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244"
checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"
dependencies = [
"deranged",
"num-conv",
@@ -1237,13 +1237,13 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "2.7.1"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba"
checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
"syn 3.0.3",
]
[[package]]
@@ -1302,9 +1302,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasm-bindgen"
version = "0.2.126"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"
checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
dependencies = [
"cfg-if",
"once_cell",
@@ -1315,9 +1315,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.126"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"
checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -1325,9 +1325,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.126"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"
checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -1338,9 +1338,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.126"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"
checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
dependencies = [
"unicode-ident",
]
+5 -5
View File
@@ -20,15 +20,15 @@ edition = "2024"
[workspace.dependencies]
anyhow = "1"
bytes = "1"
clap = { version = "4.6.1", features = ["derive"] }
getrandom = "0.4.2"
clap = { version = "4.6.6", features = ["derive"] }
getrandom = "0.4.3"
libc = "0.2"
quinn = "0.11.9"
rcgen = "0.14.8"
quinn = "0.11.11"
rcgen = "0.14.9"
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
tokio = { version = "1.52.3", features = ["macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
tokio = { version = "1.53.1", features = ["macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
tracing = "0.1"
windows-sys = "0.61.2"
+19 -5
View File
@@ -21,15 +21,29 @@ use std::{
use anyhow::{Context, Result, bail};
use bytes::Bytes;
use lanparty_ctrl::{
CONTROL_LENGTH_PREFIX_LEN, ControlMessage, DisconnectReason, EndpointHello,
MAX_CONTROL_MESSAGE_LEN, RELAY_ALPN, RoomCode, ServerWelcome, decode_control_frame,
CONTROL_LENGTH_PREFIX_LEN,
ControlMessage,
DisconnectReason,
EndpointHello,
MAX_CONTROL_MESSAGE_LEN,
RELAY_ALPN,
RoomCode,
ServerWelcome,
decode_control_frame,
encode_control_message,
};
use lanparty_obs::{DropReason, QuicDiagnostics, TunnelStats};
use lanparty_proto::{
EthernetFrame, FrameType, MacAddr, OVERLAY_FLAGS_NONE, decode_datagram, encode_datagram,
ethernet_frame_exceeds_tap_mtu, gateway_lan_safety_drop_reason,
remote_client_safety_drop_reason, validate_datagram_budget,
EthernetFrame,
FrameType,
MacAddr,
OVERLAY_FLAGS_NONE,
decode_datagram,
encode_datagram,
ethernet_frame_exceeds_tap_mtu,
gateway_lan_safety_drop_reason,
remote_client_safety_drop_reason,
validate_datagram_budget,
};
use quinn::{ClientConfig, Endpoint, crypto::rustls::QuicClientConfig};
use rustls::pki_types::CertificateDer;
+9 -3
View File
@@ -286,9 +286,15 @@ mod windows;
pub use windows::{PinnedRelayRoute, best_route_to, interface_identity_from_guid, pin_relay_route};
#[cfg(windows)]
pub use windows::{
ScopedDefaultRoutes, ScopedInterfaceMetric, ScopedInterfaceMtu, interface_metric,
interface_mtu, interface_unicast_addresses, set_scoped_default_routes_disabled,
set_scoped_interface_metric, set_scoped_interface_mtu,
ScopedDefaultRoutes,
ScopedInterfaceMetric,
ScopedInterfaceMtu,
interface_metric,
interface_mtu,
interface_unicast_addresses,
set_scoped_default_routes_disabled,
set_scoped_interface_metric,
set_scoped_interface_mtu,
};
#[cfg(not(windows))]
+40 -12
View File
@@ -1,34 +1,62 @@
use std::{
fmt, io,
fmt,
io,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
ptr::{null, null_mut},
slice,
};
use anyhow::{Context, Result, bail};
use windows_sys::Win32::{
use windows_sys::{
Win32::{
Foundation::{ERROR_OBJECT_ALREADY_EXISTS, ERROR_SUCCESS},
NetworkManagement::{
IpHelper::{
ConvertInterfaceGuidToLuid, ConvertInterfaceLuidToIndex, CreateIpForwardEntry2,
DeleteIpForwardEntry2, FreeMibTable, GetBestRoute2, GetIpInterfaceEntry,
GetUnicastIpAddressTable, IP_ADDRESS_PREFIX, InitializeIpForwardEntry,
InitializeIpInterfaceEntry, MIB_IPFORWARD_ROW2, MIB_IPINTERFACE_ROW,
MIB_UNICASTIPADDRESS_ROW, MIB_UNICASTIPADDRESS_TABLE, SetIpInterfaceEntry,
ConvertInterfaceGuidToLuid,
ConvertInterfaceLuidToIndex,
CreateIpForwardEntry2,
DeleteIpForwardEntry2,
FreeMibTable,
GetBestRoute2,
GetIpInterfaceEntry,
GetUnicastIpAddressTable,
IP_ADDRESS_PREFIX,
InitializeIpForwardEntry,
InitializeIpInterfaceEntry,
MIB_IPFORWARD_ROW2,
MIB_IPINTERFACE_ROW,
MIB_UNICASTIPADDRESS_ROW,
MIB_UNICASTIPADDRESS_TABLE,
SetIpInterfaceEntry,
},
Ndis::NET_LUID_LH,
},
Networking::WinSock::{
AF_INET, AF_INET6, AF_UNSPEC, IN_ADDR, IN_ADDR_0, IN6_ADDR, IN6_ADDR_0,
RouteProtocolNetMgmt, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKADDR_INET,
AF_INET,
AF_INET6,
AF_UNSPEC,
IN_ADDR,
IN_ADDR_0,
IN6_ADDR,
IN6_ADDR_0,
RouteProtocolNetMgmt,
SOCKADDR_IN,
SOCKADDR_IN6,
SOCKADDR_IN6_0,
SOCKADDR_INET,
},
},
core::GUID,
};
use windows_sys::core::GUID;
use crate::{
InterfaceMetricSnapshot, InterfaceMtuSnapshot, InterfaceUnicastAddress, IpInterfaceFamily,
InterfaceMetricSnapshot,
InterfaceMtuSnapshot,
InterfaceUnicastAddress,
IpInterfaceFamily,
NetworkInterfaceIdentity,
RouteSnapshot,
};
use crate::{NetworkInterfaceIdentity, RouteSnapshot};
pub fn interface_identity_from_guid(interface_guid: &str) -> Result<NetworkInterfaceIdentity> {
let guid = parse_interface_guid(interface_guid)?;
+34 -8
View File
@@ -8,25 +8,51 @@ use anyhow::{Context, Result, bail};
use lanparty_proto::MacAddr;
use windows_sys::Win32::{
Foundation::{
CloseHandle, ERROR_FILE_NOT_FOUND, ERROR_MORE_DATA, ERROR_NO_MORE_ITEMS, ERROR_SUCCESS,
GENERIC_READ, GENERIC_WRITE, HANDLE, INVALID_HANDLE_VALUE,
CloseHandle,
ERROR_FILE_NOT_FOUND,
ERROR_MORE_DATA,
ERROR_NO_MORE_ITEMS,
ERROR_SUCCESS,
GENERIC_READ,
GENERIC_WRITE,
HANDLE,
INVALID_HANDLE_VALUE,
},
Storage::FileSystem::{
CreateFileW, FILE_ATTRIBUTE_SYSTEM, FILE_SHARE_READ, FILE_SHARE_WRITE, OPEN_EXISTING,
ReadFile, WriteFile,
CreateFileW,
FILE_ATTRIBUTE_SYSTEM,
FILE_SHARE_READ,
FILE_SHARE_WRITE,
OPEN_EXISTING,
ReadFile,
WriteFile,
},
System::{
IO::DeviceIoControl,
Registry::{
HKEY, HKEY_LOCAL_MACHINE, KEY_READ, KEY_SET_VALUE, REG_SZ, RegCloseKey, RegEnumKeyExW,
RegOpenKeyExW, RegQueryValueExW, RegSetValueExW,
HKEY,
HKEY_LOCAL_MACHINE,
KEY_READ,
KEY_SET_VALUE,
REG_SZ,
RegCloseKey,
RegEnumKeyExW,
RegOpenKeyExW,
RegQueryValueExW,
RegSetValueExW,
},
},
};
use crate::{
TAP_ADAPTER_KEY, TapAdapterInfo, is_tap_component_id, tap_ioctl_get_mac, tap_ioctl_get_mtu,
tap_ioctl_set_media_status, tap_network_address_value, validate_tap_ethernet_frame,
TAP_ADAPTER_KEY,
TapAdapterInfo,
is_tap_component_id,
tap_ioctl_get_mac,
tap_ioctl_get_mtu,
tap_ioctl_set_media_status,
tap_network_address_value,
validate_tap_ethernet_frame,
};
#[derive(Debug)]
+14 -4
View File
@@ -12,14 +12,23 @@ use std::{sync::mpsc, thread, time::Duration};
use anyhow::{Context, Result, bail};
use clap::Parser;
use lanparty_client_core::{
ClientIdentity, ClientIdentityStore, ClientSession, ClientSessionConfig, connect_client,
ClientIdentity,
ClientIdentityStore,
ClientSession,
ClientSessionConfig,
connect_client,
};
#[cfg(windows)]
use lanparty_client_core::{ClientReceiveOutcome, ClientRelayIo};
#[cfg(windows)]
use lanparty_client_route::{
IpInterfaceFamily, NetworkInterfaceIdentity, PinnedRelayRoute, RouteSnapshot,
ScopedDefaultRoutes, ScopedInterfaceMetric, ScopedInterfaceMtu,
IpInterfaceFamily,
NetworkInterfaceIdentity,
PinnedRelayRoute,
RouteSnapshot,
ScopedDefaultRoutes,
ScopedInterfaceMetric,
ScopedInterfaceMtu,
};
#[cfg(windows)]
use lanparty_client_tap::TapAdapter;
@@ -1263,11 +1272,12 @@ mod tests {
time::{SystemTime, UNIX_EPOCH},
};
use super::*;
use lanparty_ctrl::{DisconnectReason, PeerInfo};
use lanparty_net::DEFAULT_RELAY_PORT;
use lanparty_obs::{QuicDiagnostics, TunnelStats};
use super::*;
#[cfg(not(windows))]
#[test]
fn rejects_runtime_on_non_windows() {
+6 -2
View File
@@ -9,8 +9,12 @@ use std::{fmt, str::FromStr};
mod codec;
pub use codec::{
CONTROL_LENGTH_PREFIX_LEN, ControlCodecError, MAX_CONTROL_MESSAGE_LEN,
complete_control_frame_len, decode_control_frame, encode_control_message,
CONTROL_LENGTH_PREFIX_LEN,
ControlCodecError,
MAX_CONTROL_MESSAGE_LEN,
complete_control_frame_len,
decode_control_frame,
encode_control_message,
};
pub use lanparty_obs::TunnelStats;
use lanparty_proto::{MIN_USEFUL_TAP_MTU, MacAddr, MtuError, recommended_tap_mtu};
+25 -10
View File
@@ -23,27 +23,42 @@ use anyhow::{Context, Result, bail};
use bytes::Bytes;
use clap::Parser;
use lanparty_ctrl::{
CONTROL_LENGTH_PREFIX_LEN, ControlMessage, DisconnectReason, EndpointHello,
MAX_CONTROL_MESSAGE_LEN, PeerInfo, RELAY_ALPN, Role, RoomCode, ServerWelcome,
decode_control_frame, encode_control_message,
CONTROL_LENGTH_PREFIX_LEN,
ControlMessage,
DisconnectReason,
EndpointHello,
MAX_CONTROL_MESSAGE_LEN,
PeerInfo,
RELAY_ALPN,
Role,
RoomCode,
ServerWelcome,
decode_control_frame,
encode_control_message,
};
use lanparty_net::RelayEndpoint;
use lanparty_obs::{DropReason, TunnelStats};
#[cfg(target_os = "linux")]
use lanparty_obs::{FrameAction, FrameDirection, FrameLog};
use lanparty_proto::{
EthernetFrame, FrameType, MacAddr, OVERLAY_FLAGS_NONE, decode_datagram, encode_datagram,
ethernet_frame_exceeds_tap_mtu, gateway_lan_safety_drop_reason,
remote_client_safety_drop_reason, validate_datagram_budget,
EthernetFrame,
FrameType,
MacAddr,
OVERLAY_FLAGS_NONE,
decode_datagram,
encode_datagram,
ethernet_frame_exceeds_tap_mtu,
gateway_lan_safety_drop_reason,
remote_client_safety_drop_reason,
validate_datagram_budget,
};
#[cfg(target_os = "linux")]
pub use packet::PacketSocket;
use quinn::{ClientConfig, Endpoint, crypto::rustls::QuicClientConfig};
use rustls::pki_types::CertificateDer;
#[cfg(target_os = "linux")]
use tokio::io::unix::AsyncFd;
#[cfg(target_os = "linux")]
pub use packet::PacketSocket;
const MAX_CONTROL_FRAME_LEN: usize = CONTROL_LENGTH_PREFIX_LEN + MAX_CONTROL_MESSAGE_LEN;
const DISCONNECT_DRAIN_TIMEOUT: Duration = Duration::from_millis(250);
#[cfg(target_os = "linux")]
@@ -1146,7 +1161,7 @@ mod tests {
let help = String::from_utf8(help).unwrap();
assert!(
help.contains("[aliases: --iface]"),
help.contains("[alias: --iface]") || help.contains("[aliases: --iface]"),
"gateway help should advertise --iface alias:\n{help}"
);
}
+2 -1
View File
@@ -1,6 +1,7 @@
use std::{
ffi::CString,
fs, io,
fs,
io,
os::fd::{AsRawFd, FromRawFd, OwnedFd, RawFd},
path::Path,
};
+33 -9
View File
@@ -11,22 +11,46 @@ mod overlay;
mod safety;
pub use ethernet::{
ETHERNET_HEADER_LEN, EthernetFrame, MAX_STANDARD_ETHERNET_FRAME_LEN,
MAX_STANDARD_ETHERNET_PAYLOAD_LEN, MIN_ETHERNET_FRAME_LEN,
ETHERNET_HEADER_LEN,
EthernetFrame,
MAX_STANDARD_ETHERNET_FRAME_LEN,
MAX_STANDARD_ETHERNET_PAYLOAD_LEN,
MIN_ETHERNET_FRAME_LEN,
};
pub use mac::{MacAddr, MacParseError};
pub use mtu::{
DEFAULT_DATAGRAM_SAFETY_MARGIN, DEFAULT_TAP_MTU, MIN_USEFUL_TAP_MTU, MtuError,
ethernet_frame_exceeds_tap_mtu, max_ethernet_frame_len_for_tap_mtu, max_tap_mtu_for_datagram,
DEFAULT_DATAGRAM_SAFETY_MARGIN,
DEFAULT_TAP_MTU,
MIN_USEFUL_TAP_MTU,
MtuError,
ethernet_frame_exceeds_tap_mtu,
max_ethernet_frame_len_for_tap_mtu,
max_tap_mtu_for_datagram,
recommended_tap_mtu,
};
pub use overlay::{
FrameType, OVERLAY_FLAGS_NONE, OVERLAY_HEADER_LEN, OVERLAY_MAGIC, OVERLAY_VERSION,
OverlayHeader, OverlayPacket, ProtoError, decode_datagram, encode_datagram,
FrameType,
OVERLAY_FLAGS_NONE,
OVERLAY_HEADER_LEN,
OVERLAY_MAGIC,
OVERLAY_VERSION,
OverlayHeader,
OverlayPacket,
ProtoError,
decode_datagram,
encode_datagram,
validate_datagram_budget,
};
pub use safety::{
ETHERTYPE_8021AD, ETHERTYPE_8021Q, ETHERTYPE_EAPOL, ETHERTYPE_IPV4, ETHERTYPE_IPV6,
ETHERTYPE_LLDP, ETHERTYPE_QINQ, ETHERTYPE_SLOW_PROTOCOLS, EthernetSafetyDrop,
gateway_lan_safety_drop_reason, remote_client_safety_drop_reason,
ETHERTYPE_8021AD,
ETHERTYPE_8021Q,
ETHERTYPE_EAPOL,
ETHERTYPE_IPV4,
ETHERTYPE_IPV6,
ETHERTYPE_LLDP,
ETHERTYPE_QINQ,
ETHERTYPE_SLOW_PROTOCOLS,
EthernetSafetyDrop,
gateway_lan_safety_drop_reason,
remote_client_safety_drop_reason,
};
+18 -7
View File
@@ -9,18 +9,28 @@ mod server;
use std::{collections::HashMap, time::Instant};
pub use config::{ConfigError, DEFAULT_RELAY_PORT, ListenEndpoint, RelayArgs, RelayConfig};
use lanparty_ctrl::{
ControlError, EndpointHello, PeerInfo, Reject, RejectReason, Role, RoomCode, ServerWelcome,
ControlError,
EndpointHello,
PeerInfo,
Reject,
RejectReason,
Role,
RoomCode,
ServerWelcome,
};
use lanparty_obs::{DropReason, FrameAction};
use lanparty_proto::{
EthernetFrame, MacAddr, ethernet_frame_exceeds_tap_mtu, gateway_lan_safety_drop_reason,
recommended_tap_mtu, remote_client_safety_drop_reason,
EthernetFrame,
MacAddr,
ethernet_frame_exceeds_tap_mtu,
gateway_lan_safety_drop_reason,
recommended_tap_mtu,
remote_client_safety_drop_reason,
};
use thiserror::Error;
pub use config::{ConfigError, DEFAULT_RELAY_PORT, ListenEndpoint, RelayArgs, RelayConfig};
pub use server::RelayServer;
use thiserror::Error;
pub const DEFAULT_MAX_CLIENTS_PER_ROOM: usize = 16;
const MEBIBYTE: u64 = 1024 * 1024;
@@ -769,9 +779,10 @@ fn reject_control_error(error: ControlError) -> Reject {
mod tests {
use std::time::{Duration, Instant};
use super::*;
use lanparty_proto::MAX_STANDARD_ETHERNET_FRAME_LEN;
use super::*;
fn room() -> RoomCode {
RoomCode::new("ABCD").unwrap()
}
+37 -11
View File
@@ -1,20 +1,42 @@
use std::{fs, net::SocketAddr, path::Path, sync::Arc};
use std::{collections::HashMap, fs, net::SocketAddr, path::Path, sync::Arc};
use anyhow::{Context, Result, anyhow, bail};
use bytes::Bytes;
use lanparty_ctrl::{
CONTROL_LENGTH_PREFIX_LEN, ControlCodecError, ControlMessage, DisconnectReason, EndpointHello,
MAX_CONTROL_MESSAGE_LEN, PeerInfo, RELAY_ALPN, Reject, RejectReason, Role, RoomCode,
ServerWelcome, decode_control_frame, encode_control_message,
CONTROL_LENGTH_PREFIX_LEN,
ControlCodecError,
ControlMessage,
DisconnectReason,
EndpointHello,
MAX_CONTROL_MESSAGE_LEN,
PeerInfo,
RELAY_ALPN,
Reject,
RejectReason,
Role,
RoomCode,
ServerWelcome,
decode_control_frame,
encode_control_message,
};
use lanparty_obs::{DropReason, FrameDirection, FrameLog, TunnelStats};
use lanparty_proto::{
EthernetFrame, FrameType, OVERLAY_FLAGS_NONE, decode_datagram, encode_datagram,
EthernetFrame,
FrameType,
OVERLAY_FLAGS_NONE,
decode_datagram,
encode_datagram,
};
use quinn::{
Endpoint,
Incoming,
RecvStream,
SendStream,
ServerConfig,
TransportConfig,
crypto::rustls::QuicServerConfig,
};
use quinn::crypto::rustls::QuicServerConfig;
use quinn::{Endpoint, Incoming, RecvStream, SendStream, ServerConfig, TransportConfig};
use rustls::pki_types::{CertificateDer, PrivateKeyDer, PrivatePkcs8KeyDer};
use std::collections::HashMap;
use tokio::sync::Mutex;
use crate::{ForwardingDecision, RelayConfig, RoomRegistry};
@@ -1014,13 +1036,17 @@ mod tests {
use lanparty_ctrl::{RoomCode, decode_control_frame, encode_control_message};
use lanparty_gateway::{GatewayConfig, connect_gateway};
use lanparty_proto::{
ETHERNET_HEADER_LEN, ETHERTYPE_IPV4, FrameType, MacAddr, decode_datagram, encode_datagram,
ETHERNET_HEADER_LEN,
ETHERTYPE_IPV4,
FrameType,
MacAddr,
decode_datagram,
encode_datagram,
};
use quinn::{ClientConfig, crypto::rustls::QuicClientConfig};
use crate::{DEFAULT_MAX_CLIENTS_PER_ROOM, ListenEndpoint};
use super::*;
use crate::{DEFAULT_MAX_CLIENTS_PER_ROOM, ListenEndpoint};
const ETHERTYPE_ARP: u16 = 0x0806;
const ARP_REQUEST: u16 = 1;
+3
View File
@@ -0,0 +1,3 @@
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
imports_layout = "HorizontalVertical"