pub struct DcEntry {
pub dc_id: i32,
pub addr: String,
pub auth_key: Option<[u8; 256]>,
pub first_salt: i64,
pub time_offset: i32,
pub flags: DcFlags,
}Expand description
One entry in the DC address table.
Fields§
§dc_id: i32§addr: String§auth_key: Option<[u8; 256]>§first_salt: i64§time_offset: i32§flags: DcFlagsDC capability flags (IPv6, media-only, CDN, …).
Implementations§
Source§impl DcEntry
impl DcEntry
Sourcepub fn socket_addr(&self) -> Result<SocketAddr>
pub fn socket_addr(&self) -> Result<SocketAddr>
Parse the stored "ip:port" / "[ipv6]:port" address into a
std::net::SocketAddr.
Both formats are valid:
- IPv4:
"149.154.175.53:443" - IPv6:
"[2001:b28:f23d:f001::a]:443"
Sourcepub fn from_parts(dc_id: i32, ip: &str, port: u16, flags: DcFlags) -> Self
pub fn from_parts(dc_id: i32, ip: &str, port: u16, flags: DcFlags) -> Self
Construct a DcEntry from separate IP string, port, and flags.
IPv6 addresses are automatically wrapped in brackets so that
socket_addr() can round-trip them correctly:
DcEntry::from_parts(2, "2001:b28:f23d:f001::a", 443, DcFlags::IPV6)
// addr = "[2001:b28:f23d:f001::a]:443"This is the preferred constructor when processing help.getConfig
DcOption objects from the Telegram API.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DcEntry
impl<'de> Deserialize<'de> for DcEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DcEntry
impl RefUnwindSafe for DcEntry
impl Send for DcEntry
impl Sync for DcEntry
impl Unpin for DcEntry
impl UnsafeUnpin for DcEntry
impl UnwindSafe for DcEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more