Configuration package (#369)
This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration"
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/settings"
|
||||
"github.com/qdm12/golibs/logging"
|
||||
"github.com/qdm12/golibs/os"
|
||||
)
|
||||
@@ -19,8 +19,8 @@ type Looper interface {
|
||||
RunRestartTicker(ctx context.Context, wg *sync.WaitGroup)
|
||||
GetStatus() (status models.LoopStatus)
|
||||
SetStatus(status models.LoopStatus) (outcome string, err error)
|
||||
GetSettings() (settings settings.PublicIP)
|
||||
SetSettings(settings settings.PublicIP) (outcome string)
|
||||
GetSettings() (settings configuration.PublicIP)
|
||||
SetSettings(settings configuration.PublicIP) (outcome string)
|
||||
GetPublicIP() (publicIP net.IP)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ type looper struct {
|
||||
const defaultBackoffTime = 5 * time.Second
|
||||
|
||||
func NewLooper(client *http.Client, logger logging.Logger,
|
||||
settings settings.PublicIP, puid, pgid int,
|
||||
settings configuration.PublicIP, puid, pgid int,
|
||||
os os.OS) Looper {
|
||||
return &looper{
|
||||
state: state{
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration"
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
"github.com/qdm12/gluetun/internal/settings"
|
||||
)
|
||||
|
||||
type state struct {
|
||||
status models.LoopStatus
|
||||
settings settings.PublicIP
|
||||
settings configuration.PublicIP
|
||||
ip net.IP
|
||||
statusMu sync.RWMutex
|
||||
settingsMu sync.RWMutex
|
||||
@@ -72,13 +72,13 @@ func (l *looper) SetStatus(status models.LoopStatus) (outcome string, err error)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *looper) GetSettings() (settings settings.PublicIP) {
|
||||
func (l *looper) GetSettings() (settings configuration.PublicIP) {
|
||||
l.state.settingsMu.RLock()
|
||||
defer l.state.settingsMu.RUnlock()
|
||||
return l.state.settings
|
||||
}
|
||||
|
||||
func (l *looper) SetSettings(settings settings.PublicIP) (outcome string) {
|
||||
func (l *looper) SetSettings(settings configuration.PublicIP) (outcome string) {
|
||||
l.state.settingsMu.Lock()
|
||||
defer l.state.settingsMu.Unlock()
|
||||
settingsUnchanged := reflect.DeepEqual(settings, l.state.settings)
|
||||
|
||||
Reference in New Issue
Block a user