style: rename controllers to login, cancel internal/pkg
This commit is contained in:
33
internal/http_client/http_default.go
Normal file
33
internal/http_client/http_default.go
Normal file
@@ -0,0 +1,33 @@
|
||||
//go:build !linux
|
||||
|
||||
package http_client
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"github.com/Mmx233/BitSrunLoginGo/internal/config"
|
||||
"github.com/Mmx233/BitSrunLoginGo/tools"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func CreateClientFromEth(eth *tools.Eth) *http.Client {
|
||||
var addr net.Addr
|
||||
if eth != nil {
|
||||
addr = eth.Addr
|
||||
}
|
||||
|
||||
return &http.Client{
|
||||
Transport: &http.Transport{
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: config.Timeout,
|
||||
LocalAddr: addr,
|
||||
}).DialContext,
|
||||
TLSHandshakeTimeout: config.Timeout,
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: config.Settings.Basic.SkipCertVerify,
|
||||
},
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
},
|
||||
Timeout: config.Timeout,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user