V0 #2
7 changed files with 30 additions and 31 deletions
generalize node holder connection
commit
3e2dc9099a
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -541,6 +541,7 @@ name = "proxy"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"log",
|
||||
"proxy-common",
|
||||
"prudpv0",
|
||||
"prudpv1",
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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(¶m, edge_node_dc_callback).await;
|
||||
|
||||
proxy::start_insecure(param).await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(¶m, edge_node_dc_callback).await;
|
||||
proxy::start_secure(param).await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue