fix: provider auto update
This commit is contained in:
@ -43,6 +43,14 @@ func (f *fetcher) Initial() (any, error) {
|
||||
err error
|
||||
isLocal bool
|
||||
)
|
||||
|
||||
defer func() {
|
||||
// pull proxies automatically
|
||||
if f.ticker != nil {
|
||||
go f.pullLoop()
|
||||
}
|
||||
}()
|
||||
|
||||
if stat, fErr := os.Stat(f.vehicle.Path()); fErr == nil {
|
||||
buf, err = os.ReadFile(f.vehicle.Path())
|
||||
modTime := stat.ModTime()
|
||||
@ -84,11 +92,6 @@ func (f *fetcher) Initial() (any, error) {
|
||||
|
||||
f.hash = md5.Sum(buf)
|
||||
|
||||
// pull proxies automatically
|
||||
if f.ticker != nil {
|
||||
go f.pullLoop()
|
||||
}
|
||||
|
||||
return proxies, nil
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ func (h *HTTPVehicle) Read() ([]byte, error) {
|
||||
// from http.DefaultTransport
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 30 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
TLSHandshakeTimeout: 5 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
conn := inner.HandleTcp(address, uri.Hostname())
|
||||
|
Reference in New Issue
Block a user