Created
September 1, 2019 16:45
-
-
Save khorevaa/8aaa604ecee084c97216138c949a1b97 to your computer and use it in GitHub Desktop.
Telegram bot with proxy TOR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = tgbotapi.SetLogger(logger) | |
var proxy = "socks5://127.0.0.1:9150" // Tor proxy for testing | |
//creating the proxyURL | |
proxyURL, err := url.Parse(proxy) | |
transCfg := &http.Transport{ | |
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, | |
Proxy: http.ProxyURL(proxyURL),// ignore expired SSL certificates | |
} | |
httpClient := http.Client{ | |
Transport: transCfg, | |
} | |
mybot, err := tgbotapi.NewBotAPIWithClient(token, &httpClient) | |
if err != nil { | |
logger.WithError(err).Panic("Error create new bot") | |
} | |
mybot.Debug = true | |
logger.Debugf("Authorized on account %s", mybot.Self.UserName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment