1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::Deserialize;
use std::{fmt, net::IpAddr};

#[derive(Debug, Deserialize)]
pub struct Connection {
    /// Public IP of the device
    #[serde(rename = "ip_addr")]
    pub ip: IpAddr,

    pub port: u64,
}

impl fmt::Display for Connection {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}:{}", self.ip, self.port)
    }
}