2018-10-21 06:25:24 +00:00
|
|
|
extern crate bytes;
|
2018-04-11 05:39:28 +00:00
|
|
|
#[macro_use] extern crate clap;
|
|
|
|
extern crate futures;
|
2018-09-18 06:15:02 +00:00
|
|
|
extern crate http;
|
|
|
|
extern crate hyper;
|
2018-10-21 03:02:24 +00:00
|
|
|
extern crate tokio;
|
2018-09-21 00:58:51 +00:00
|
|
|
extern crate tokio_codec;
|
2018-04-14 22:18:50 +00:00
|
|
|
extern crate tokio_io;
|
2018-10-21 23:19:27 +00:00
|
|
|
#[macro_use] extern crate warp;
|
2018-10-27 22:13:18 +00:00
|
|
|
extern crate weak_table;
|
2018-04-11 05:39:28 +00:00
|
|
|
extern crate webmetro;
|
|
|
|
|
|
|
|
mod commands;
|
2018-04-11 04:55:41 +00:00
|
|
|
|
|
|
|
use clap::{App, AppSettings};
|
2018-04-15 02:34:46 +00:00
|
|
|
|
2018-04-12 01:54:02 +00:00
|
|
|
use commands::{
|
|
|
|
relay,
|
2018-04-12 06:03:46 +00:00
|
|
|
filter,
|
2018-04-15 05:43:23 +00:00
|
|
|
send,
|
2018-04-12 01:54:02 +00:00
|
|
|
dump
|
|
|
|
};
|
2018-04-11 04:55:41 +00:00
|
|
|
|
2018-04-11 05:50:18 +00:00
|
|
|
fn options() -> App<'static, 'static> {
|
|
|
|
App::new("webmetro")
|
2018-04-11 04:55:41 +00:00
|
|
|
.version(crate_version!())
|
|
|
|
.about("Utilities for broadcasting & relaying live WebM video/audio streams")
|
2018-04-15 05:43:23 +00:00
|
|
|
.setting(AppSettings::DisableHelpSubcommand)
|
2018-04-11 04:55:41 +00:00
|
|
|
.setting(AppSettings::VersionlessSubcommands)
|
2018-04-11 05:50:18 +00:00
|
|
|
.subcommand(relay::options())
|
2018-04-12 06:03:46 +00:00
|
|
|
.subcommand(filter::options())
|
2018-04-15 05:43:23 +00:00
|
|
|
.subcommand(send::options())
|
2018-04-12 01:54:02 +00:00
|
|
|
.subcommand(dump::options())
|
2018-04-11 05:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let args = options().get_matches();
|
2018-04-11 04:55:41 +00:00
|
|
|
|
2018-10-21 02:06:42 +00:00
|
|
|
match args.subcommand() {
|
2018-10-21 03:02:24 +00:00
|
|
|
("filter", Some(sub_args)) => filter::run(sub_args),
|
|
|
|
("relay", Some(sub_args)) => relay::run(sub_args),
|
|
|
|
("send", Some(sub_args)) => send::run(sub_args),
|
|
|
|
("dump", Some(sub_args)) => dump::run(sub_args),
|
2018-10-21 02:06:42 +00:00
|
|
|
_ => {
|
2018-04-11 05:50:18 +00:00
|
|
|
options().print_help().unwrap();
|
2018-04-11 23:45:02 +00:00
|
|
|
println!("");
|
2018-10-21 03:02:24 +00:00
|
|
|
Ok(())
|
2018-10-21 02:06:42 +00:00
|
|
|
}
|
2018-10-21 03:02:24 +00:00
|
|
|
}.unwrap_or_else(|err| {
|
|
|
|
eprintln!("Error: {}", err);
|
|
|
|
});
|
2018-04-15 02:34:46 +00:00
|
|
|
}
|