mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: Move proxy address config to app.conf
Signed-off-by: WindSpiritSR <simon343riley@gmail.com>
This commit is contained in:
parent
98e0c1aa85
commit
1bca883f4f
@ -7,5 +7,5 @@ driverName = mysql
|
||||
dataSourceName = root:123@tcp(localhost:3306)/
|
||||
dbName = casdoor
|
||||
authState = "casdoor"
|
||||
useProxy = false
|
||||
httpProxy = "127.0.0.1:10808"
|
||||
verificationCodeTimeout = 10
|
@ -24,18 +24,14 @@ import (
|
||||
var httpClient *http.Client
|
||||
|
||||
func InitHttpClient() {
|
||||
useProxy, err := beego.AppConfig.Bool("useProxy")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if !useProxy {
|
||||
httpProxy := beego.AppConfig.String("httpProxy")
|
||||
if httpProxy == "" {
|
||||
httpClient = &http.Client{}
|
||||
return
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/33585587/creating-a-go-socks5-client
|
||||
proxyAddress := "127.0.0.1:10808"
|
||||
dialer, err := proxy.SOCKS5("tcp", proxyAddress, nil, proxy.Direct)
|
||||
dialer, err := proxy.SOCKS5("tcp", httpProxy, nil, proxy.Direct)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user