chore(all): memory and thread safe storage
- 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
This commit is contained in:
@@ -15,18 +15,6 @@ type AllServers struct {
|
||||
ProviderToServers map[string]Servers
|
||||
}
|
||||
|
||||
func (a *AllServers) ServersSlice(provider string) []Server {
|
||||
if provider == providers.Custom {
|
||||
return nil
|
||||
}
|
||||
|
||||
servers, ok := a.ProviderToServers[provider]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("provider %s not found in all servers", provider))
|
||||
}
|
||||
return copyServers(servers.Servers)
|
||||
}
|
||||
|
||||
var _ json.Marshaler = (*AllServers)(nil)
|
||||
|
||||
// MarshalJSON marshals all servers to JSON.
|
||||
|
||||
Reference in New Issue
Block a user