Skip to content

Commit

Permalink
refactor: remove ngcontrol protocol and update sysinfo lib (8xFF#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm authored Nov 26, 2024
1 parent 6603489 commit 31c1a8e
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 465 deletions.
34 changes: 2 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ members = [
"packages/media_record",
"packages/media_codecs",
"packages/multi_tenancy",
"packages/rtpengine_ngcontrol",
]

[workspace.dependencies]
sans-io-runtime = { version = "0.3", default-features = false }
atm0s-sdn = { git = "https://github.com/giangndm/8xFF-decentralized-sdn.git", branch = "feat-router-dump", default-features = false }
atm0s-sdn-network = { git = "https://github.com/giangndm/8xFF-decentralized-sdn.git", branch = "feat-router-dump", default-features = false }
atm0s-sdn = { version = "0.2", default-features = false }
atm0s-sdn-network = { version = "0.6", default-features = false }
tokio = "1.37"
tracing-subscriber = { version = "0.3", features = ["env-filter", "std"] }
convert-enum = "0.1"
Expand Down
5 changes: 2 additions & 3 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ media-server-connector = { path = "../packages/media_connector", optional = true
media-server-record = { path = "../packages/media_record", default-features=false, optional = true }
media-server-utils = { path = "../packages/media_utils", optional = true }
media-server-multi-tenancy = { path = "../packages/multi_tenancy", optional = true }
rtpengine-ngcontrol = { path = "../packages/rtpengine_ngcontrol", optional = true }
local-ip-address = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
Expand All @@ -36,7 +35,7 @@ num_enum = { workspace = true }
derive_more = { workspace = true, features = ["full"] }
rcgen = { version = "0.13", optional = true }
maxminddb = { version = "0.24", optional = true }
sysinfo = { version = "0.31", optional = true }
sysinfo = { version = "0.32", optional = true }
hex = { version = "0.4", optional = true }
mime_guess = { version = "2.0", optional = true }
reqwest = { version = "0.12", features = ["json"]}
Expand All @@ -46,7 +45,7 @@ sentry = "0.34"
default = ["console", "gateway", "media", "connector", "standalone", "cert_utils"]
standalone = ["console", "gateway", "media", "connector"]
gateway = ["media-server-gateway", "media-server-connector", "quinn_vnet", "node_metrics", "maxminddb", "rust-embed", "media-server-multi-tenancy"]
media = ["media-server-runner", "media-server-record", "quinn_vnet", "node_metrics", "rtpengine-ngcontrol"]
media = ["media-server-runner", "media-server-record", "quinn_vnet", "node_metrics"]
console = []
connector = ["quinn_vnet", "media-server-connector", "media-server-utils", "media-server-multi-tenancy"]
cert_utils = ["rcgen", "rustls"]
Expand Down
1 change: 0 additions & 1 deletion bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use media_server_protocol::cluster::ZoneId;

mod errors;
mod http;
mod ng_controller;
#[cfg(feature = "node_metrics")]
mod node_metrics;
#[cfg(feature = "quinn_vnet")]
Expand Down
126 changes: 0 additions & 126 deletions bin/src/ng_controller.rs

This file was deleted.

17 changes: 1 addition & 16 deletions bin/src/server/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ use media_server_protocol::{
rpc::quinn::{QuinnClient, QuinnServer},
};
use media_server_secure::jwt::{MediaEdgeSecureJwt, MediaGatewaySecureJwt};
use rtpengine_ngcontrol::NgUdpTransport;
use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer};
use std::net::SocketAddr;
use tokio::sync::mpsc::channel;

use crate::{
http::{run_gateway_http_server, NodeApiCtx},
ng_controller::NgControllerServer,
node_metrics::NodeMetricsCollector,
quinn::{make_quinn_client, make_quinn_server, VirtualNetwork},
NodeConfig,
Expand Down Expand Up @@ -119,20 +117,6 @@ pub async fn run_media_gateway(workers: usize, http_port: Option<u16>, node: Nod
let gateway_secure = MediaGatewaySecureJwt::new(node.secret.as_bytes(), app_storage.clone());
let gateway_secure = Arc::new(gateway_secure);

let (req_tx, mut req_rx) = tokio::sync::mpsc::channel(1024);
// Running ng controller for Voip
if let Some(ngproto_addr) = args.rtpengine_cmd_addr {
let req_tx = req_tx.clone();
let rtpengine_udp = NgUdpTransport::new(ngproto_addr).await;
let secure2 = edge_secure.clone();
tokio::spawn(async move {
log::info!("[MediaGateway] start ng_controller task");
let mut server = NgControllerServer::new(rtpengine_udp, secure2, req_tx);
while server.recv().await.is_some() {}
log::info!("[MediaGateway] stop ng_controller task");
});
}

// Setup Sdn
let node_id = node.node_id;
let mut builder = SdnBuilder::<(), SC, SE, TC, TW, ClusterNodeInfo>::new(node_id, &node.bind_addrs, node.bind_addrs_alt);
Expand Down Expand Up @@ -165,6 +149,7 @@ pub async fn run_media_gateway(workers: usize, http_port: Option<u16>, node: Nod
let (selector, mut requester) = build_dest_selector();

// Setup HTTP server
let (req_tx, mut req_rx) = tokio::sync::mpsc::channel(1024);
let (dump_tx, mut dump_rx) = channel(10);
if let Some(http_port) = http_port {
let req_tx = req_tx.clone();
Expand Down
19 changes: 0 additions & 19 deletions bin/src/server/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ use media_server_runner::{MediaConfig, UserData, SE};
use media_server_secure::jwt::{MediaEdgeSecureJwt, MediaGatewaySecureJwt};
use media_server_utils::now_ms;
use rand::random;
use rtpengine_ngcontrol::NgUdpTransport;
use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer};
use sans_io_runtime::{backend::PollingBackend, Controller};
use tokio::sync::mpsc::channel;

use crate::{
http::{run_media_http_server, NodeApiCtx},
ng_controller::NgControllerServer,
node_metrics::NodeMetricsCollector,
quinn::{make_quinn_server, VirtualNetwork},
server::media::runtime_worker::MediaRuntimeWorker,
Expand Down Expand Up @@ -60,10 +58,6 @@ pub struct Args {
#[arg(env, long, default_value_t = 0)]
pub webrtc_port_seed: u16,

/// The port for binding the RTPengine command UDP socket.
#[arg(env, long)]
pub rtpengine_cmd_addr: Option<SocketAddr>,

/// The IP address for RTPengine RTP listening.
/// Default: 127.0.0.1
#[arg(env, long, default_value = "127.0.0.1")]
Expand Down Expand Up @@ -119,19 +113,6 @@ pub async fn run_media_server(workers: usize, http_port: Option<u16>, node: Node
});
}

//Running ng controller for Voip
if let Some(ngproto_addr) = args.rtpengine_cmd_addr {
let req_tx = req_tx.clone();
let rtpengine_udp = NgUdpTransport::new(ngproto_addr).await;
let secure = secure.clone();
tokio::spawn(async move {
log::info!("[MediaServer] start ng_controller task");
let mut server = NgControllerServer::new(rtpengine_udp, secure, req_tx);
while server.recv().await.is_some() {}
log::info!("[MediaServer] stop ng_controller task");
});
}

let node_id = node.node_id;
let node_session = random();

Expand Down
1 change: 0 additions & 1 deletion bin/src/server/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ pub async fn run_standalone(workers: usize, node: NodeConfig, args: Args) {
enable_token_api: false,
ice_lite: false,
webrtc_port_seed: 0,
rtpengine_cmd_addr: None,
rtpengine_listen_ip,
ccu_per_core: 200,
record_cache,
Expand Down
10 changes: 0 additions & 10 deletions packages/rtpengine_ngcontrol/Cargo.toml

This file was deleted.

Loading

0 comments on commit 31c1a8e

Please sign in to comment.