Updater loop with period and http route (#240)
* Updater loop with period and http route * Using DNS over TLS to update servers * Better logging * Remove goroutines for cyberghost updater * Respects context for servers update (quite slow overall) * Increase shutdown grace period to 5 seconds * Update announcement * Add log lines for each provider update start
This commit is contained in:
@@ -14,8 +14,10 @@ import (
|
||||
|
||||
func (u *updater) updatePurevpn(ctx context.Context) (err error) {
|
||||
servers, warnings, err := findPurevpnServers(ctx, u.httpGet, u.lookupIP)
|
||||
for _, warning := range warnings {
|
||||
u.println(warning)
|
||||
if u.options.CLI {
|
||||
for _, warning := range warnings {
|
||||
u.logger.Warn("PureVPN: %s", warning)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot update Purevpn servers: %w", err)
|
||||
@@ -76,6 +78,9 @@ func findPurevpnServers(ctx context.Context, httpGet httpGetFunc, lookupIP looku
|
||||
return data[i].Region < data[j].Region
|
||||
})
|
||||
for _, jsonServer := range data {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, warnings, err
|
||||
}
|
||||
if jsonServer.UDP == "" && jsonServer.TCP == "" {
|
||||
warnings = append(warnings, fmt.Sprintf("server %s %s %s does not support TCP and UDP for openvpn", jsonServer.Region, jsonServer.Country, jsonServer.City))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user