Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements a Proxy Integration #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bart1909
Copy link
Contributor

Now, you can use HTTP or SOCKS5 proxies with this bot.
In config.yaml under telegram add the two following lines:
http_proxy: http://user:[email protected]:3128
https_proxy: http://user:[email protected]:3128

If you are using SOCKS5 proxy, the lines looks like this:
http_proxy: socks5://user:[email protected]:3128
https_proxy: socks5://user:[email protected]:3128

Maybe you have to run the following line to install socks-compability:
pip install requests[socks]

Now, you can use HTTP or SOCKS5 proxies with this bot. 
In config.yaml under telegram add the two following lines:
http_proxy: http://user:[email protected]:3128
https_proxy: http://user:[email protected]:3128

If you are using SOCKS5 proxy, the lines looks like this:
http_proxy: socks5://user:[email protected]:3128
https_proxy: socks5://user:[email protected]:3128

Maybe you have to run the following line to install socks-compability:
pip install requests[socks]
@Bart1909 Bart1909 mentioned this pull request Apr 27, 2018
@StrannikZet
Copy link

StrannikZet commented May 18, 2018

2018-05-17_17-01-28
The provider blocks DNS requests or substitutes. Wrap the DNS in a proxy or Tor.

@filimonic
Copy link

filimonic commented Dec 31, 2018

![2018-05-17_17-01-28]
The provider blocks DNS requests or substitutes. Wrap the DNS in a proxy or Tor.

Official docs for python requests
@StrannikZet
Use socks5h scheme instead of socks5.

Ensure your proxy allows dns resolving:

Simulation of local resolver

curl --socks5 your-proxy-host:port https://api.telegram.org -v -v

Simulation of remote resolver (through your socks5)

curl --socks5-hostname your-proxy-host:port https://api.telegram.org -v -v

@filimonic
Copy link

@fabianonline Please take a note on this. Very popular feature in Russia

@StrannikZet
Copy link

![2018-05-17_17-01-28]
The provider blocks DNS requests or substitutes. Wrap the DNS in a proxy or Tor.

Official docs for python requests
@StrannikZet
Use socks5h scheme instead of socks5.

Ensure your proxy allows dns resolving:

Simulation of local resolver

curl --socks5 your-proxy-host:port https://api.telegram.org -v -v

Simulation of remote resolver (through your socks5)

curl --socks5-hostname your-proxy-host:port https://api.telegram.org -v -v

I have corrected. Thank you, it works!

@rdeanar
Copy link

rdeanar commented Jan 23, 2019

It is very useful! Can't wait for merge.

@Spirituss
Copy link

It doesn't work any more. Neither socks5 nor socks5h make possible to connect to the server. I receive "Got an exception while initially trying to connect to telegram (Listener not running: HTTPSConnectionPool(host='api.telegram.org', port=443)". Is any idea?

@rdeanar
Copy link

rdeanar commented Feb 5, 2019

@Spirituss it works for me.
You can try to ping host api.telegram.org from terminal of your octoprint server.
If it doesn't work, change primary dns server i.e. to Google dns 8.8.8.8 or 8.8.4.4.

@filimonic
Copy link

It doesn't work any more. Neither socks5 nor socks5h make possible to connect to the server. I receive "Got an exception while initially trying to connect to telegram (Listener not running: HTTPSConnectionPool(host='api.telegram.org', port=443)". Is any idea?

Works good for me. Probably your socks provider is dead ?

@filimonic
Copy link

filimonic commented Mar 9, 2019

@Spirituss it works for me.
You can try to ping host api.telegram.org from terminal of your octoprint server.
If it doesn't work, change primary dns server i.e. to Google dns 8.8.8.8 or 8.8.4.4.

You should not change DNS servers. Use "socks5h" instead of "socks5" - this makes DNS resolutions made by socks server, not by client ( "socks5" resolves names NOT through proxy )

@hallskelet
Copy link

@Spirituss it works for me.
You can try to ping host api.telegram.org from terminal of your octoprint server.
If it doesn't work, change primary dns server i.e. to Google dns 8.8.8.8 or 8.8.4.4.

This does not work! Providers intercept requests for addresses 8.8.8.8 and 8.8.4.4 for the operation of blocking services.

@Vasiy
Copy link

Vasiy commented Sep 27, 2019

@Spirituss it works for me.
You can try to ping host api.telegram.org from terminal of your octoprint server.
If it doesn't work, change primary dns server i.e. to Google dns 8.8.8.8 or 8.8.4.4.

This does not work! Providers intercept requests for addresses 8.8.8.8 and 8.8.4.4 for the operation of blocking services.

You can take 1.1.1.1 or 1.0.0.1 DNS

@whoim2
Copy link

whoim2 commented Apr 30, 2020

please, see this way (nging proxy)
Add custom server, not api.telegram.org

https://habr.com/ru/post/424427/

@giloser
Copy link
Collaborator

giloser commented Feb 18, 2021

Hi,

I will finally try to implement that in the master.
as there was a lot of conflict I'll implement it on my fork and ask for someone to test because I don't work with proxies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants