steps39 / dtgbot

Telegram Bot for Domoticz
19 stars 18 forks source link

Feature request: Support SOCKS4/SOCKS5 proxy #9

Closed ilya-fedin closed 6 years ago

ilya-fedin commented 6 years ago

This is necessary to work in countries where Telegram is blocked

jvanderzande commented 6 years ago

Do you know what is needed for that as I haven't played with SOCKS proxy's as yet and don't have an setup available to play with anyways. A pull request is always welcome in case somebody know what to do here.

Jos

ilya-fedin commented 6 years ago

Can you add support for at least HTTP proxy? SOCKS proxy can be wrapped in HTTP via polipo/privoxy.

jvanderzande commented 6 years ago

My answer is the same as I don't see the difference really between an http and socks proxy. The dtgbot.lua script is using these libraries:

-- Load necessary Lua libraries
http = require "socket.http";
socket = require "socket";
https = require "ssl.https";

.. and we are using https.request() to get the data from telegram, so simply open dtgbot.lua and have a play with that commandline : response, status = https.request(telegram_url..'getUpdates?timeout=60&offset='..TelegramBotOffset) .. and see whether you can modify it to your needs. Jos

ilya-fedin commented 6 years ago

Ok, thank you.

jvanderzande commented 6 years ago

... and ? Have you been able to see whether it can be adapted to support Proxy's?

ilya-fedin commented 6 years ago

Google says that ssl.https can't make requests through a proxy, it is possible through curl bindings to do. But I'm not a lua programmer, so I just installed majordomo - its bot can work through a proxy.