V0 #2

Closed
RusticMaple wants to merge 58 commits from v0 into main
7 changed files with 30 additions and 31 deletions
Showing only changes of commit 3e2dc9099a - Show all commits

generalize node holder connection

Maple 2026-01-31 18:53:22 +01:00

1
Cargo.lock generated
View file

@ -541,6 +541,7 @@ name = "proxy"
version = "0.1.0"
dependencies = [
"cfg-if",
"log",
"proxy-common",
"prudpv0",
"prudpv1",

View file

@ -10,6 +10,7 @@ prudpv1 = { path = "../prudpv1", optional = true }
proxy-common = { path = "../proxy-common" }
cfg-if = "1.0.4"
rnex-core = { path = "../rnex-core", version = "0.1.1" }
log = "0.4.25"
[features]
prudpv0 = ["dep:prudpv0"]

View file

@ -1,13 +1,17 @@
use proxy_common::ProxyStartupParam;
use std::process::abort;
use proxy::edge_node_dc_callback;
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
use rnex_core::common::setup;
#[tokio::main]
async fn main() {
setup();
proxy::start_insecure(
ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
.expect("unable to get startup parameters"),
)
.await;
let param = ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
.expect("unable to get startup parameters");
setup_edge_node_connection(&param, edge_node_dc_callback).await;
proxy::start_insecure(param).await;
}

View file

@ -1,4 +1,7 @@
use std::process::abort;
use cfg_if::cfg_if;
use log::error;
cfg_if! {
if #[cfg(feature = "prudpv0")]{
@ -9,3 +12,8 @@ cfg_if! {
compile_error!("no proxy type has been set");
}
}
pub fn edge_node_dc_callback() {
error!("disconnected from node holder, aborting!");
abort()
}

View file

@ -1,12 +1,14 @@
use proxy_common::ProxyStartupParam;
use proxy::edge_node_dc_callback;
use proxy_common::{ProxyStartupParam, setup_edge_node_connection};
use rnex_core::common::setup;
#[tokio::main]
async fn main() {
setup();
proxy::start_secure(
ProxyStartupParam::new(proxy_common::ProxyType::Secure)
.expect("unable to get startup parameters"),
)
.await;
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
.expect("unable to get startup parameters");
setup_edge_node_connection(&param, edge_node_dc_callback).await;
proxy::start_secure(param).await;
}

View file

@ -21,7 +21,7 @@ use tokio::task;
use tokio::time::sleep;
pub async fn start() {
let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
/*let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
.await
.unwrap();
@ -36,7 +36,7 @@ pub async fn start() {
let conn = new_rmc_gateway_connection(conn, |r| {
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
});
});*/
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
.await

View file

@ -23,23 +23,6 @@ use tokio::task;
use tokio::time::sleep;
pub async fn start() {
let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
.await
.unwrap();
let conn: SplittableBufferConnection = conn.into();
conn.send(
Register(SocketAddrV4::new(*OWN_IP_PUBLIC, *SERVER_PORT))
.to_data()
.unwrap(),
)
.await;
let conn = new_rmc_gateway_connection(conn, |r| {
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
});
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
.await
.expect("unable to start router");