mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Merge pull request #138 from WindSpiritSR/patch-proxy-config
fix: Move proxy address config to app.conf
This commit is contained in:
commit
00b00a20de
@ -7,5 +7,5 @@ driverName = mysql
|
|||||||
dataSourceName = root:123@tcp(localhost:3306)/
|
dataSourceName = root:123@tcp(localhost:3306)/
|
||||||
dbName = casdoor
|
dbName = casdoor
|
||||||
authState = "casdoor"
|
authState = "casdoor"
|
||||||
useProxy = false
|
httpProxy = "127.0.0.1:10808"
|
||||||
verificationCodeTimeout = 10
|
verificationCodeTimeout = 10
|
@ -24,18 +24,14 @@ import (
|
|||||||
var httpClient *http.Client
|
var httpClient *http.Client
|
||||||
|
|
||||||
func InitHttpClient() {
|
func InitHttpClient() {
|
||||||
useProxy, err := beego.AppConfig.Bool("useProxy")
|
httpProxy := beego.AppConfig.String("httpProxy")
|
||||||
if err != nil {
|
if httpProxy == "" {
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
if !useProxy {
|
|
||||||
httpClient = &http.Client{}
|
httpClient = &http.Client{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/33585587/creating-a-go-socks5-client
|
// https://stackoverflow.com/questions/33585587/creating-a-go-socks5-client
|
||||||
proxyAddress := "127.0.0.1:10808"
|
dialer, err := proxy.SOCKS5("tcp", httpProxy, nil, proxy.Direct)
|
||||||
dialer, err := proxy.SOCKS5("tcp", proxyAddress, nil, proxy.Direct)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user