Add support for socks5 proxy
alextokarew opened this issue · 3 comments
alextokarew commented
It would be nice to specify socks5 proxy settings for accessing telegram API in application itself and not to rely on external tools such as proxychains etc.
bemyak commented
You can use http proxy something like this:
use hyper::Client;
use hyper_proxy::{Intercept, Proxy, ProxyConnector};
use hyper_rustls::HttpsConnector;
use telegram_bot::HyperConnector;
...
let proxy_url = env::var("http_proxy");
let proxy = Proxy::new(Intercept::All, proxy_url.parse().unwrap());
let connector = ProxyConnector::from_proxy(HttpsConnector::new(), proxy)?;
let connector = Box::new(HyperConnector::new(
Client::builder().build(connector),
))
let api = Api::with_connector(token, connector);
...
You can also configure Tor to be an HTTP proxy by adding HTTPTunnelPort 9080
in /etc/tor/torrc
.
Nanue1 commented
Nanue1 commented
how to fix this error?