tg在没配置代理的情况下会获取系统代理
This commit is contained in:
parent
afb4ddc3a8
commit
fa214721cd
10
lib/tg.go
10
lib/tg.go
|
@ -1,7 +1,6 @@
|
||||||
package lib
|
package lib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -78,13 +77,16 @@ func (t *Telegram) Init() {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t.bot, err = tgbotapi.NewBotAPIWithClient(t.Token, conf.GetConfig().TG.CustomApi+"/bot%s/%s", &http.Client{Transport: &http.Transport{
|
t.bot, err = tgbotapi.NewBotAPIWithClient(t.Token, conf.GetConfig().TG.CustomApi+"/bot%s/%s", &http.Client{Transport: &http.Transport{
|
||||||
// 设置代理
|
// 设置代理
|
||||||
Proxy: func(r *http.Request) (*url.URL, error) {
|
Proxy: func(r *http.Request) (*url.URL, error) {
|
||||||
return uri, nil
|
if uri != nil {
|
||||||
|
return uri, nil
|
||||||
|
} else {
|
||||||
|
return http.ProxyFromEnvironment(r)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
|
//TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
|
||||||
}})
|
}})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue