feat(gateway): accept iface CLI alias
PLAN.md tells LAN hosts to start the gateway with --iface, while the binary only accepted --interface. Add --iface as a Clap alias so the documented Phase 1 command works without changing the canonical config field name. The README gateway example now uses the shorthand from the plan, and a focused parse test covers the alias mapping to the same interface field. Test Plan: - cargo fmt --check - cargo test -p lanparty-gateway \ accepts_iface_alias_for_gateway_interface -- --nocapture - cargo test -p lanparty-gateway - cargo clippy -p lanparty-gateway --all-targets -- -D warnings - cargo test --workspace - cargo clippy --workspace --all-targets -- -D warnings - git diff --check Refs: PLAN.md
This commit is contained in:
@@ -143,7 +143,7 @@ cargo run -p lanparty-gateway -- \
|
|||||||
--server-name lanparty-relay.local \
|
--server-name lanparty-relay.local \
|
||||||
--relay-ca-cert relay-cert.der \
|
--relay-ca-cert relay-cert.der \
|
||||||
--room ROOM1 \
|
--room ROOM1 \
|
||||||
--interface eth0
|
--iface eth0
|
||||||
```
|
```
|
||||||
|
|
||||||
The gateway connects to the relay as `role = gateway`, completes the
|
The gateway connects to the relay as `role = gateway`, completes the
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ pub struct GatewayArgs {
|
|||||||
room: RoomCode,
|
room: RoomCode,
|
||||||
|
|
||||||
/// Wired LAN interface that will later be opened with AF_PACKET.
|
/// Wired LAN interface that will later be opened with AF_PACKET.
|
||||||
#[arg(long)]
|
#[arg(long, alias = "iface")]
|
||||||
interface: String,
|
interface: String,
|
||||||
|
|
||||||
/// Gateway's advertised QUIC datagram budget before relay clamping.
|
/// Gateway's advertised QUIC datagram budget before relay clamping.
|
||||||
@@ -832,6 +832,23 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn accepts_iface_alias_for_gateway_interface() {
|
||||||
|
let args = GatewayArgs::parse_from([
|
||||||
|
"lanparty-gateway",
|
||||||
|
"--relay",
|
||||||
|
"127.0.0.1:443",
|
||||||
|
"--relay-ca-cert",
|
||||||
|
"relay-cert.der",
|
||||||
|
"--room",
|
||||||
|
"ROOM1",
|
||||||
|
"--iface",
|
||||||
|
"eth0",
|
||||||
|
]);
|
||||||
|
|
||||||
|
assert_eq!(args.interface, "eth0");
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn connects_to_relay_control_stream_as_gateway() {
|
async fn connects_to_relay_control_stream_as_gateway() {
|
||||||
let (server_config, certificate) = test_server_config();
|
let (server_config, certificate) = test_server_config();
|
||||||
|
|||||||
Reference in New Issue
Block a user