fix(client): replace todo!() with stubs to prevent crashes

Problem:
Client terminal was closing immediately on connect command because
todo!() macros in TUN interface and relay functions were causing panics.

Changes:
1.  Replaced create_tun_interface() todo with stub returning dummy interface
2.  Replaced configure_routing() todo with stub (no-op)
3.  Replaced cleanup_routing() todo with stub (no-op)
4.  Replaced relay_traffic() todo with infinite sleep (keeps connection alive)
5.  Added warning messages with yellow ⚠ indicator for stub functions
6.  Updated SHA256SUMS for both packages
7.  Recreated distribution archives
8.  Added CONFIG_FILES.md explaining server-enrollment.json.example usage

Client Behavior Now:
- Connection establishes successfully
- Shows [STUB] warnings for TUN/routing/relay
- Stays connected (Ctrl+C to exit)
- No actual traffic forwarding yet (TODO for next iteration)

server-enrollment.json.example Usage:
- For Standalone mode (connecting to existing Master Node)
- Requires enrollment_token from admin
- psk: 'AUTO' until approved
- See CONFIG_FILES.md for detailed workflow

Next Steps:
- Implement real TUN interface using osn crate
- Implement route configuration via ip command
- Implement packet relay loop (TUN ↔ OSTP client)
- Add daemon mode (fork + detach)

Distribution:
- ostp-server-linux-x64.tar.gz: 6.85 MB
- ostp-client-linux-x64.tar.gz: 0.92 MB (updated client)
This commit is contained in:
2026-01-02 03:40:04 +03:00
parent a7ec878518
commit 50c8adfdfa
8 changed files with 97 additions and 6 deletions

View File

@@ -545,21 +545,34 @@ async fn handle_profiles(action: Option<ProfileAction>) -> Result<()> {
// TUN interface management
fn create_tun_interface() -> Result<TunInterface> {
// Placeholder - will use osn crate
todo!("TUN interface creation not yet implemented")
tracing::warn!("TUN interface creation not yet fully implemented - using stub");
println!(" {}[STUB] TUN interface (ostp0)", style("").yellow());
Ok(TunInterface {
name: "ostp0".to_string(),
})
}
fn configure_routing(_tun: &TunInterface) -> Result<()> {
// Configure routes via ip command
todo!("Route configuration not yet implemented")
tracing::warn!("Route configuration not yet fully implemented - using stub");
println!(" {}[STUB] Routes configured", style("").yellow());
Ok(())
}
fn cleanup_routing(_tun: &TunInterface) -> Result<()> {
todo!("Route cleanup not yet implemented")
tracing::debug!("Route cleanup - stub");
Ok(())
}
async fn relay_traffic(_client: &mut OstpClient, _tun: &TunInterface) -> Result<()> {
// Main packet relay loop
todo!("Traffic relay not yet implemented")
tracing::warn!("Traffic relay not yet fully implemented - connection will stay idle");
println!(" {}[STUB] Traffic relay active (no actual forwarding yet)", style("").yellow());
// Keep connection alive - wait indefinitely
// In real implementation, this would be the packet forwarding loop
tokio::time::sleep(tokio::time::Duration::from_secs(u64::MAX)).await;
Ok(())
}
struct TunInterface {