Commit c1f3be0b authored by Mathias Jud's avatar Mathias Jud

qaul-linux client

parent 81d2c265
......@@ -2045,10 +2045,13 @@ dependencies = [
"igd",
"ipnetwork",
"libqaul",
"libqaul-http",
"libqaul-rpc1",
"netmod-tcp",
"netmod-udp",
"pnet",
"qaul-chat",
"qaul-voice",
"ratman",
"ratman-configure",
"tracing",
......
......@@ -6,12 +6,15 @@ edition = "2018"
license = "GPL-3.0"
[dependencies]
libqaul = { path = "../../libqaul" }
chat = { path = "../../libqaul/service/chat", package = "qaul-chat" }
netmod-tcp = { path = "../../netmods/netmod-tcp" }
netmod-udp = { path = "../../netmods/netmod-udp" }
ratman = { path = "../../ratman" }
ratman-configure = { path = "../../ratman/configure" }
libqaul = { path = "../../libqaul" }
libqaul-rpc1 = { path = "../../libqaul/rpc", features = ["chat", "json"] }
libqaul-http = { path = "../../libqaul/http" }
qaul-chat = { path = "../../libqaul/service/chat" }
qaul-voice = { path = "../../libqaul/service/voice" }
async-std = { version = "=1.5", features = ["attributes"] }
clap = { version = "2.0", features = ["wrap_help", "color"] }
......
144.91.74.192:9001
95.216.98.55:11443
\ No newline at end of file
......@@ -4,7 +4,7 @@ use ratman_configure::config::{Endpoint, Network, Params};
use std::collections::BTreeMap;
use std::{env, fs::File, io::Read, path::PathBuf, sync::Arc};
/// The hub configuration
/// The app configuration
#[derive(Debug, Clone)]
pub(crate) struct Config {
/// Path to initial peer set
......@@ -19,6 +19,8 @@ pub(crate) struct Config {
pub(crate) no_upnp: bool,
/// Disable multicast local discovery
pub(crate) no_multicast: bool,
/// Web GUI path
pub(crate) webgui: String,
}
impl Config {
......@@ -58,7 +60,7 @@ impl Config {
}
pub(crate) fn cli<'a>() -> App<'a, 'a> {
App::new("qaul-hubd")
App::new("qaul-linux")
.about(env!("CARGO_PKG_DESCRIPTION"))
.version(env!("CARGO_PKG_VERSION"))
.arg(
......@@ -78,7 +80,7 @@ pub(crate) fn cli<'a>() -> App<'a, 'a> {
.value_name("MODE")
.default_value("static")
.possible_values(&["static", "dynamic"])
.help("The hub's run mode"),
.help("qaul's run mode"),
)
.arg(
Arg::with_name("SOCKET_ADDR")
......@@ -87,7 +89,7 @@ pub(crate) fn cli<'a>() -> App<'a, 'a> {
.takes_value(true)
.value_name("ADDR")
.default_value("0.0.0.0")
.help("The hub's bound socket address"),
.help("qaul's bound socket address"),
)
.arg(
Arg::with_name("SOCKET_PORT")
......@@ -96,7 +98,7 @@ pub(crate) fn cli<'a>() -> App<'a, 'a> {
.takes_value(true)
.required(true)
.value_name("PORT")
.help("The hub's bound socket port"),
.help("qaul bound socket port"),
)
.arg(
Arg::with_name("NO_UPNP")
......@@ -105,7 +107,11 @@ pub(crate) fn cli<'a>() -> App<'a, 'a> {
).arg(
Arg::with_name("NO_UDP_DISCOVER")
.long("no-udp-discover")
.help("Prevent qaul-hubd from registering a multicast address to find other clients on the same network")
.help("Prevent qaul from registering a multicast address to find other clients on the same network")
).arg(
Arg::with_name("WEBGUI_PATH")
.long("webgui-path")
.help("Path to the WebGUI.")
)
}
......@@ -120,7 +126,10 @@ pub(crate) fn match_fold<'a>(app: App<'a, 'a>) -> Config {
Config {
peers: {
let p = m.value_of("PEERS_PATH").map(|s| s.to_owned()).unwrap();
let p = m.value_of("PEERS_PATH")
.map(|s| s.to_owned())
.or(env::var("QAUL_PEERS").ok())
.unwrap();
let mut buf = PathBuf::new();
buf.push(p);
buf
......@@ -128,21 +137,26 @@ pub(crate) fn match_fold<'a>(app: App<'a, 'a>) -> Config {
mode: m
.value_of("RUN_MODE")
.map(|s| s.to_owned())
.or(env::var("QAUL_HUBD_MODE").ok())
.or(env::var("QAUL_MODE").ok())
.unwrap_or("static".into()),
addr: m
.value_of("SOCKET_ADDR")
.map(|s| s.to_owned())
.or(env::var("QAUL_HUBD_ADDR").ok())
.or(env::var("QAUL_ADDR").ok())
.unwrap_or("0.0.0.0".into()),
port: m
.value_of("SOCKET_PORT")
.map(|s| str::parse(s).unwrap())
.or(env::var("QAUL_HUBD_PORThat")
.or(env::var("QAUL_PORT")
.ok()
.map(|s| str::parse(&s).unwrap()))
.unwrap_or(9001),
no_upnp: m.is_present("NO_UPNP"),
no_multicast: m.is_present("NO_UDP_DISCOVER"),
webgui: m
.value_of("WEBGUI_PATH")
.map(|s| s.to_owned())
.or(env::var("QAUL_WEBGUI_PATH").ok())
.unwrap_or("emberweb/dist".into()),
}
}
......@@ -2,11 +2,18 @@
use crate::cfg::Config;
use directories::ProjectDirs;
use libqaul::Qaul;
use netmod_tcp::{Endpoint, Mode};
use ratman::Router;
use std::collections::HashSet;
use std::{fs::File, io::Read, net::SocketAddr, str::FromStr, sync::Arc};
use async_std::{task, task::spawn};
use {
libqaul::{users::UserUpdate, Qaul},
libqaul_http::{stream, HttpServer},
libqaul_rpc1::Responder,
qaul_chat::Chat,
qaul_voice::Voice,
};
#[allow(unused)]
pub(crate) struct State {
......@@ -20,7 +27,7 @@ impl State {
let ep = Endpoint::new(
&cfg.addr,
cfg.port,
"qaul-hubd",
"qaul-linux",
match cfg.mode.as_str() {
"dynamic" => Mode::Dynamic,
_ => Mode::Static,
......@@ -42,6 +49,38 @@ impl State {
let dirs = ProjectDirs::from("net", "qaul", "hubd").unwrap();
let qaul = Qaul::new(Arc::clone(&router));
// services
let chat = Chat::new(Arc::clone(&qaul)).await.unwrap();
let voices = Voice::new(Arc::clone(&qaul)).await.unwrap();
// print information for the user
println!("Path to static web content: {}", cfg.webgui);
println!("Open the UI in your web browser:");
println!("WebGUI: http://127.0.0.1:9900");
// configure the web servers
let server = HttpServer::set_paths(
cfg.webgui.clone(),
Responder {
streamer: stream::setup_streamer(),
qaul: Arc::clone(&qaul),
chat: chat,
voice: voices,
},
);
task::spawn(async move {
let http = server.listen("127.0.0.1:9900");
});
/*
// run the servers
task::block_on(async move {
let a = server_a.listen("127.0.0.1:9900");
let b = server_b.listen("127.0.0.1:9901");
try_join!(a, b).unwrap();
});
*/
Self { qaul, router }
}
}
# qaul-linux - qaul.net linux client
This client is still in it's early stage. It provides the
## Build & Run
The client is automatically built, when building qaul.net with cargo.
To run the client, you need to set the environment variables first
```
# set environment variables
export HUBD_PEERS=/PATH/TO/peers.txt
export HUBD_PORT=9001
# start
qaul-linux -P peers.txt
```
## Network Modules
The following network modules are available:
* netmod-tcp: for Internet overlay networks.
* netmod-udp: to find clients in the local network.
## Configuration Options
Following is a list of qaul-hubd configuration values. Those marked
with a `*` are mandatory. Commandline arguments take precedence over
environment variables.
| ENV variable | Runtime argument | Description |
|----------------------|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `*` HUBD_PEERS=[PATH] | -P / --peers [PATH] | Specify the path to a peer file, containing a newline-separated list of peers to connect to |
| `*` HUBD_PORT=[PORT] | -p / --port [PORT] | Specify a tcp port to which qaul-hubd should bind itself to listen for incoming network traffic |
| HUBD_UDP_DISCOVERY=0 | --no-udp-discover | Prevent qaul-hubd from registering a multicast address to find other clients on the same network. Some networks may forbid this, or cause performance issues. |
| HUBD_SETUP_UPNP=0 | --no-upnp | Disable automatic UPNP port forwarding. Some networks may forbid this, or cause performance issues. |
| HUBD_RUN_MODE=[MODE] | -m / --mode [MODE] | Specify the peering mode of this hub. Possible values: "static", "dynamic" |
| HUBD_ADDR=[ADDR] | -a / --addr [ADDR] | A valid address to bind to. Must be a valid ip address format. |
### Internet Overlay Network Peers
In order for the qaul.net instance to connect to an Internet overlay network. You can create a file with a new line separated list of IP addresses.
`peers.txt`
```
144.91.74.192:9001
95.216.98.55:11443
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment