1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#![deny(missing_docs)]
#![deny(warnings)]
#![deny(unsafe_code)]
#![doc = tx5_core::__doc_header!()]
//! # tx5-signal-srv
//!
//! Holochain webrtc signal server.

#![doc = include_str!("docs/srv_help.md")]

/// Re-exported dependencies.
pub mod deps {
    pub use tx5_core::deps::*;
}

use once_cell::sync::Lazy;

static METRICS_REQ_COUNT: Lazy<prometheus::IntCounter> = Lazy::new(|| {
    prometheus::register_int_counter!(
        "metrics_req_cnt",
        "metrics request count"
    )
    .unwrap()
});

static METRICS_REQ_TIME_S: Lazy<prometheus::Histogram> = Lazy::new(|| {
    prometheus::register_histogram!(
        "metrics_req_time_s",
        "metrics request time in seconds"
    )
    .unwrap()
});

static CLIENT_ACTIVE_WS_COUNT: Lazy<prometheus::IntGauge> = Lazy::new(|| {
    prometheus::register_int_gauge!(
        "client_active_ws_cnt",
        "currently active websocket connection count"
    )
    .unwrap()
});

static CLIENT_WS_COUNT: Lazy<prometheus::IntCounter> = Lazy::new(|| {
    prometheus::register_int_counter!(
        "client_ws_cnt",
        "incoming websocket connection count"
    )
    .unwrap()
});

static CLIENT_AUTH_WS_COUNT: Lazy<prometheus::IntCounter> = Lazy::new(|| {
    prometheus::register_int_counter!(
        "client_auth_ws_cnt",
        "incoming websocket connection count that complete authentication"
    )
    .unwrap()
});

static CLIENT_WS_REQ_TIME_S: Lazy<prometheus::Histogram> = Lazy::new(|| {
    prometheus::register_histogram!(
        "client_ws_req_time_s",
        "client websocket request time in seconds"
    )
    .unwrap()
});

static REQ_FWD_CNT: Lazy<prometheus::IntCounter> = Lazy::new(|| {
    prometheus::register_int_counter!(
        "req_fwd_cnt",
        "total count of forward requests processed"
    )
    .unwrap()
});

static REQ_DEMO_CNT: Lazy<prometheus::IntCounter> = Lazy::new(|| {
    prometheus::register_int_counter!(
        "req_demo_cnt",
        "total count of demo broadcast requests processed"
    )
    .unwrap()
});

pub use tx5_core::{Error, ErrorExt, Id, Result};

use clap::Parser;

mod config;
pub use config::*;

mod server;
pub use server::*;