pub struct DcConnection { /* private fields */ }Expand description
A single encrypted connection to one Telegram DC.
Implementations§
Source§impl DcConnection
impl DcConnection
Sourcepub async fn connect_raw(
addr: &str,
socks5: Option<&Socks5Config>,
transport: &TransportKind,
) -> Result<Self, InvocationError>
pub async fn connect_raw( addr: &str, socks5: Option<&Socks5Config>, transport: &TransportKind, ) -> Result<Self, InvocationError>
Connect and perform full DH handshake.
Sourcepub async fn connect_with_key(
addr: &str,
auth_key: [u8; 256],
first_salt: i64,
time_offset: i32,
socks5: Option<&Socks5Config>,
transport: &TransportKind,
) -> Result<Self, InvocationError>
pub async fn connect_with_key( addr: &str, auth_key: [u8; 256], first_salt: i64, time_offset: i32, socks5: Option<&Socks5Config>, transport: &TransportKind, ) -> Result<Self, InvocationError>
Connect with an already-known auth key (no DH needed).
pub fn auth_key_bytes(&self) -> [u8; 256]
pub fn first_salt(&self) -> i64
pub fn time_offset(&self) -> i32
pub async fn rpc_call<R: RemoteCall>( &mut self, req: &R, ) -> Result<Vec<u8>, InvocationError>
Auto Trait Implementations§
impl !Freeze for DcConnection
impl RefUnwindSafe for DcConnection
impl Send for DcConnection
impl Sync for DcConnection
impl Unpin for DcConnection
impl UnsafeUnpin for DcConnection
impl UnwindSafe for DcConnection
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> 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