huginn_net_http/output/
common.rs1use std::fmt;
2use std::fmt::Formatter;
3
4#[derive(Debug, Clone, PartialEq)]
5#[cfg_attr(feature = "json", derive(serde::Serialize))]
6pub struct IpPort {
7 pub ip: std::net::IpAddr,
8 pub port: u16,
9}
10
11impl IpPort {
12 pub fn new(ip: std::net::IpAddr, port: u16) -> Self {
13 Self { ip, port }
14 }
15}
16
17#[derive(Clone, Debug, PartialEq, Eq)]
22#[cfg_attr(feature = "json", derive(serde::Serialize))]
23pub enum OsKind {
24 Specified,
25 Generic,
26}
27
28impl fmt::Display for OsKind {
29 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
30 f.write_str(match self {
31 OsKind::Specified => "Specified",
32 OsKind::Generic => "Generic",
33 })
34 }
35}
36
37#[derive(Clone, Debug)]
44#[cfg_attr(feature = "json", derive(serde::Serialize))]
45pub enum MatchQuality {
46 Matched(f32),
47 NotMatched,
48 Disabled,
49}
50
51#[derive(Debug, Clone)]
53#[cfg_attr(feature = "json", derive(serde::Serialize))]
54pub struct Browser {
55 pub name: String,
56 pub family: Option<String>,
57 pub variant: Option<String>,
58 pub kind: OsKind,
59}
60
61#[derive(Debug, Clone)]
63#[cfg_attr(feature = "json", derive(serde::Serialize))]
64pub struct WebServer {
65 pub name: String,
66 pub family: Option<String>,
67 pub variant: Option<String>,
68 pub kind: OsKind,
69}