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:
@@ -5,11 +5,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/openvpn"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/provider/common"
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
servers []models.Server
|
||||
storage common.Storage
|
||||
randSource rand.Source
|
||||
timeNow func() time.Time
|
||||
// Port forwarding
|
||||
@@ -17,11 +17,11 @@ type Provider struct {
|
||||
authFilePath string
|
||||
}
|
||||
|
||||
func New(servers []models.Server, randSource rand.Source,
|
||||
func New(storage common.Storage, randSource rand.Source,
|
||||
timeNow func() time.Time) *Provider {
|
||||
const jsonPortForwardPath = "/gluetun/piaportforward.json"
|
||||
return &Provider{
|
||||
servers: servers,
|
||||
storage: storage,
|
||||
timeNow: timeNow,
|
||||
randSource: randSource,
|
||||
portForwardPath: jsonPortForwardPath,
|
||||
|
||||
Reference in New Issue
Block a user