Torguard support (#387)

See discussion on #374
This commit is contained in:
Quentin McGaw
2021-02-17 20:36:30 -05:00
committed by GitHub
parent c5af536299
commit f1b1001863
24 changed files with 545 additions and 7 deletions

View File

@@ -50,8 +50,8 @@ func New(settings configuration.Updater, httpClient *http.Client,
}
}
// TODO parallelize DNS resolution.
func (u *updater) UpdateServers(ctx context.Context) (allServers models.AllServers, err error) { //nolint:gocognit
//nolint:gocognit,gocyclo
func (u *updater) UpdateServers(ctx context.Context) (allServers models.AllServers, err error) {
if u.options.Cyberghost {
u.logger.Info("updating Cyberghost servers...")
if err := u.updateCyberghost(ctx); err != nil {
@@ -124,6 +124,16 @@ func (u *updater) UpdateServers(ctx context.Context) (allServers models.AllServe
}
}
if u.options.Torguard {
u.logger.Info("updating Torguard servers...")
if err := u.updateTorguard(ctx); err != nil {
if ctxErr := ctx.Err(); ctxErr != nil {
return allServers, ctxErr
}
u.logger.Error(err)
}
}
if u.options.Vyprvpn {
u.logger.Info("updating Vyprvpn servers...")
if err := u.updateVyprvpn(ctx); err != nil {