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
#[macro_use] extern crate log;
pub mod client;
#[cfg(feature = "http")]
pub mod hurl;
pub mod serializer;
pub mod measurement;
use client::{Client, Credentials};
use client::udp::UdpClient;
#[cfg(feature = "http")]
use client::http::HttpClient;
#[cfg(feature = "http")]
use hurl::hyper::HyperHurl;
use serializer::Serializer;
use serializer::line::LineSerializer;
#[cfg(feature = "http")]
pub fn create_client<'a>(credentials: Credentials<'a>, hosts: Vec<&'a str>) -> HttpClient<'a> {
let mut client = HttpClient::new(credentials, Box::new(LineSerializer::new()), Box::new(HyperHurl::new()));
for host in hosts {
client.add_host(host);
}
client
}
pub fn create_udp_client<'a>(hosts: Vec<&'a str>) -> UdpClient<'a> {
let mut client = UdpClient::new(Box::new(LineSerializer::new()));
for host in hosts {
client.add_host(host);
}
client
}