Compare commits
5 commits
f9ec599ded
...
119fd14f50
| Author | SHA1 | Date | |
|---|---|---|---|
| 119fd14f50 | |||
| 184314975a | |||
| 7c53ed5ae7 | |||
| b53def2613 | |||
| b5c94b562e |
1 changed files with 14 additions and 0 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
|
|||
// RETICULUM INCLUDES
|
||||
use reticulum::iface::tcp_client::TcpClient;
|
||||
use reticulum::iface::tcp_server::TcpServer;
|
||||
use reticulum::iface::udp::UdpInterface;
|
||||
use reticulum::transport::{Transport, TransportConfig};
|
||||
use tokio::time::{Duration, interval};
|
||||
|
||||
|
|
@ -22,10 +23,17 @@ struct TcpClientConfig {
|
|||
bind_addr: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
struct UdpConfig {
|
||||
bind_addr: String,
|
||||
forward_addr: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
enum InterfaceConfig {
|
||||
TcpServer(TcpServerConfig),
|
||||
TcpClient(TcpClientConfig),
|
||||
Udp(UdpConfig),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
|
|
@ -84,6 +92,12 @@ async fn main() {
|
|||
.await
|
||||
.spawn(TcpClient::new(cfg.bind_addr), TcpClient::spawn);
|
||||
}
|
||||
InterfaceConfig::Udp(cfg) => {
|
||||
let _ = transport.iface_manager().lock().await.spawn(
|
||||
UdpInterface::new(cfg.bind_addr, cfg.forward_addr),
|
||||
UdpInterface::spawn,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue