pub struct Connection {
pub stream: TcpStream,
pub enc: EncryptedSession,
pub frame_kind: FrameKind,
pub perm_auth_key: Option<[u8; 256]>,
}Fields§
§stream: TcpStream§enc: EncryptedSession§frame_kind: FrameKind§perm_auth_key: Option<[u8; 256]>When PFS is active, the permanent auth key (stored in session).
enc holds the temp key; this field holds the perm key so
auth_key_bytes() returns the right value to persist.
Implementations§
Source§impl Connection
impl Connection
pub async fn connect_raw( addr: &str, socks5: Option<&Socks5Config>, mtproxy: Option<&MtProxyConfig>, transport: &TransportKind, dc_id: i16, ) -> Result<Self, ConnectError>
pub async fn connect_with_key( addr: &str, auth_key: [u8; 256], first_salt: i64, time_offset: i32, socks5: Option<&Socks5Config>, mtproxy: Option<&MtProxyConfig>, transport: &TransportKind, dc_id: i16, pfs: bool, ) -> Result<Self, ConnectError>
pub fn auth_key_bytes(&self) -> [u8; 256]
Sourcepub fn into_writer(
self,
) -> (ConnectionWriter, OwnedWriteHalf, OwnedReadHalf, FrameKind)
pub fn into_writer( self, ) -> (ConnectionWriter, OwnedWriteHalf, OwnedReadHalf, FrameKind)
Split into a write-only ConnectionWriter and the TCP read half.
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl !UnwindSafe for Connection
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> 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