2021-07-23 20:41:45 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
|
|
import (
|
2022-06-11 01:34:30 +00:00
|
|
|
"context"
|
2021-07-23 20:41:45 +00:00
|
|
|
"sync"
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2022-06-11 01:34:30 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
2021-07-23 20:41:45 +00:00
|
|
|
)
|
|
|
|
|
|
2022-06-11 01:34:30 +00:00
|
|
|
func New(statusApplier StatusApplier,
|
2022-01-06 06:40:23 -05:00
|
|
|
settings settings.HTTPProxy) *State {
|
2021-07-23 20:41:45 +00:00
|
|
|
return &State{
|
|
|
|
|
statusApplier: statusApplier,
|
|
|
|
|
settings: settings,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type State struct {
|
2022-06-11 01:34:30 +00:00
|
|
|
statusApplier StatusApplier
|
2022-01-06 06:40:23 -05:00
|
|
|
settings settings.HTTPProxy
|
2021-07-23 20:41:45 +00:00
|
|
|
settingsMu sync.RWMutex
|
|
|
|
|
}
|
2022-06-11 01:34:30 +00:00
|
|
|
|
|
|
|
|
type StatusApplier interface {
|
|
|
|
|
ApplyStatus(ctx context.Context, status models.LoopStatus) (
|
|
|
|
|
outcome string, err error)
|
|
|
|
|
}
|