generalize node holder connection
This commit is contained in:
parent
7ea43b101d
commit
3e2dc9099a
7 changed files with 30 additions and 31 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -541,6 +541,7 @@ name = "proxy"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"log",
|
||||||
"proxy-common",
|
"proxy-common",
|
||||||
"prudpv0",
|
"prudpv0",
|
||||||
"prudpv1",
|
"prudpv1",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ prudpv1 = { path = "../prudpv1", optional = true }
|
||||||
proxy-common = { path = "../proxy-common" }
|
proxy-common = { path = "../proxy-common" }
|
||||||
cfg-if = "1.0.4"
|
cfg-if = "1.0.4"
|
||||||
rnex-core = { path = "../rnex-core", version = "0.1.1" }
|
rnex-core = { path = "../rnex-core", version = "0.1.1" }
|
||||||
|
log = "0.4.25"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
prudpv0 = ["dep:prudpv0"]
|
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;
|
use rnex_core::common::setup;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
proxy::start_insecure(
|
let param = ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
|
||||||
ProxyStartupParam::new(proxy_common::ProxyType::Insecure)
|
.expect("unable to get startup parameters");
|
||||||
.expect("unable to get startup parameters"),
|
|
||||||
)
|
setup_edge_node_connection(¶m, edge_node_dc_callback).await;
|
||||||
.await;
|
|
||||||
|
proxy::start_insecure(param).await;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
use std::process::abort;
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
use log::error;
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "prudpv0")]{
|
if #[cfg(feature = "prudpv0")]{
|
||||||
|
|
@ -9,3 +12,8 @@ cfg_if! {
|
||||||
compile_error!("no proxy type has been set");
|
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;
|
use rnex_core::common::setup;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
setup();
|
setup();
|
||||||
proxy::start_secure(
|
|
||||||
ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
let param = ProxyStartupParam::new(proxy_common::ProxyType::Secure)
|
||||||
.expect("unable to get startup parameters"),
|
.expect("unable to get startup parameters");
|
||||||
)
|
|
||||||
.await;
|
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;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
pub async fn start() {
|
pub async fn start() {
|
||||||
let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
|
/*let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ pub async fn start() {
|
||||||
|
|
||||||
let conn = new_rmc_gateway_connection(conn, |r| {
|
let conn = new_rmc_gateway_connection(conn, |r| {
|
||||||
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
Arc::new(OnlyRemote::<RemoteEdgeNodeHolder>::new(r))
|
||||||
});
|
});*/
|
||||||
|
|
||||||
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
|
|
@ -23,23 +23,6 @@ use tokio::task;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
pub async fn start() {
|
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))
|
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
|
||||||
.await
|
.await
|
||||||
.expect("unable to start router");
|
.expect("unable to start router");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue