1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

use rtdlib::types::*;
use crate::api::TDFB;


///  A HTTP transparent proxy server.  
#[derive(Debug, Clone)]
pub struct TGProxyTypeHttp {
  ///  Username for logging in; may be empty. 
  username: Option<String>,
  ///  Password for logging in; may be empty. 
  password: Option<String>,
  ///  Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method. 
  http_only: Option<bool>,
  
}

impl TDFB for TGProxyTypeHttp {}

impl AsRef<TGProxyTypeHttp> for TGProxyTypeHttp {
  fn as_ref(&self) -> &TGProxyTypeHttp { self }
}

impl TGProxyTypeHttp {
  pub fn new() -> Self {
    Self {
      username: None,
      password: None,
      http_only: None,
      
    }
  }

  #[doc(hidden)]
  pub fn build(&self) -> ProxyTypeHttp {
    ProxyTypeHttp::builder()
      .username(self.username.clone())
      .password(self.password.clone())
      .http_only(self.http_only.clone())
      
      .build()
  }

  
  pub fn username<S: AsRef<str>>(&mut self, username: S) -> &mut Self {
    self.username = Some(username.as_ref().to_string());
    self
  }
  
  pub fn password<S: AsRef<str>>(&mut self, password: S) -> &mut Self {
    self.password = Some(password.as_ref().to_string());
    self
  }
  
  pub fn http_only(&mut self, http_only: bool) -> &mut Self {
    self.http_only = Some(http_only);
    self
  }
  

}


///  An MTProto proxy server.  
#[derive(Debug, Clone)]
pub struct TGProxyTypeMtproto {
  ///  The proxy's secret in hexadecimal encoding. 
  secret: Option<String>,
  
}

impl TDFB for TGProxyTypeMtproto {}

impl AsRef<TGProxyTypeMtproto> for TGProxyTypeMtproto {
  fn as_ref(&self) -> &TGProxyTypeMtproto { self }
}

impl TGProxyTypeMtproto {
  pub fn new() -> Self {
    Self {
      secret: None,
      
    }
  }

  #[doc(hidden)]
  pub fn build(&self) -> ProxyTypeMtproto {
    ProxyTypeMtproto::builder()
      .secret(self.secret.clone())
      
      .build()
  }

  
  pub fn secret<S: AsRef<str>>(&mut self, secret: S) -> &mut Self {
    self.secret = Some(secret.as_ref().to_string());
    self
  }
  

}


///  A SOCKS5 proxy server.  
#[derive(Debug, Clone)]
pub struct TGProxyTypeSocks5 {
  ///  Username for logging in; may be empty. 
  username: Option<String>,
  ///  Password for logging in; may be empty. 
  password: Option<String>,
  
}

impl TDFB for TGProxyTypeSocks5 {}

impl AsRef<TGProxyTypeSocks5> for TGProxyTypeSocks5 {
  fn as_ref(&self) -> &TGProxyTypeSocks5 { self }
}

impl TGProxyTypeSocks5 {
  pub fn new() -> Self {
    Self {
      username: None,
      password: None,
      
    }
  }

  #[doc(hidden)]
  pub fn build(&self) -> ProxyTypeSocks5 {
    ProxyTypeSocks5::builder()
      .username(self.username.clone())
      .password(self.password.clone())
      
      .build()
  }

  
  pub fn username<S: AsRef<str>>(&mut self, username: S) -> &mut Self {
    self.username = Some(username.as_ref().to_string());
    self
  }
  
  pub fn password<S: AsRef<str>>(&mut self, password: S) -> &mut Self {
    self.password = Some(password.as_ref().to_string());
    self
  }
  

}