Maint: loopstate package used in Openvpn state
This commit is contained in:
38
internal/loopstate/state.go
Normal file
38
internal/loopstate/state.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package loopstate
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
|
||||
type Manager interface {
|
||||
Locker
|
||||
Getter
|
||||
Setter
|
||||
Applier
|
||||
}
|
||||
|
||||
func New(status models.LoopStatus,
|
||||
start chan<- struct{}, running <-chan models.LoopStatus,
|
||||
stop chan<- struct{}, stopped <-chan struct{}) *State {
|
||||
return &State{
|
||||
status: status,
|
||||
start: start,
|
||||
running: running,
|
||||
stop: stop,
|
||||
stopped: stopped,
|
||||
}
|
||||
}
|
||||
|
||||
type State struct {
|
||||
loopMu sync.RWMutex
|
||||
|
||||
status models.LoopStatus
|
||||
statusMu sync.RWMutex
|
||||
|
||||
start chan<- struct{}
|
||||
running <-chan models.LoopStatus
|
||||
stop chan<- struct{}
|
||||
stopped <-chan struct{}
|
||||
}
|
||||
Reference in New Issue
Block a user