- settings: get filter choices from storage for settings validation - updater: update servers to the storage - storage: minimal deep copying and data duplication - storage: add merged servers mutex for thread safety - connection: filter servers in storage - formatter: format servers to Markdown in storage - PIA: get server by name from storage directly - Updater: get servers count from storage directly - Updater: equality check done in storage, fix #882
28 lines
822 B
Go
28 lines
822 B
Go
package storage
|
|
|
|
import (
|
|
"github.com/qdm12/gluetun/internal/configuration/settings/validation"
|
|
"github.com/qdm12/gluetun/internal/constants/providers"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
)
|
|
|
|
func (s *Storage) GetFilterChoices(provider string) models.FilterChoices {
|
|
if provider == providers.Custom {
|
|
return models.FilterChoices{}
|
|
}
|
|
|
|
s.mergedMutex.RLock()
|
|
defer s.mergedMutex.RUnlock()
|
|
|
|
serversObject := s.getMergedServersObject(provider)
|
|
servers := serversObject.Servers
|
|
return models.FilterChoices{
|
|
Countries: validation.ExtractCountries(servers),
|
|
Regions: validation.ExtractRegions(servers),
|
|
Cities: validation.ExtractCities(servers),
|
|
ISPs: validation.ExtractISPs(servers),
|
|
Names: validation.ExtractServerNames(servers),
|
|
Hostnames: validation.ExtractHostnames(servers),
|
|
}
|
|
}
|