2021-07-23 20:41:45 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"sync"
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2021-07-23 20:41:45 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/loopstate"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var _ Manager = (*State)(nil)
|
|
|
|
|
|
|
|
|
|
type Manager interface {
|
2021-07-24 19:49:50 +00:00
|
|
|
SettingsGetSetter
|
2021-07-23 20:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
2022-06-05 14:58:46 +00:00
|
|
|
func New(statusApplier loopstate.Applier, vpn settings.VPN) *State {
|
2021-07-23 20:41:45 +00:00
|
|
|
return &State{
|
|
|
|
|
statusApplier: statusApplier,
|
2021-08-18 21:27:09 +00:00
|
|
|
vpn: vpn,
|
2021-07-23 20:41:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type State struct {
|
|
|
|
|
statusApplier loopstate.Applier
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
vpn settings.VPN
|
2021-07-23 20:41:45 +00:00
|
|
|
settingsMu sync.RWMutex
|
|
|
|
|
}
|