Maint: loopstate package used in Openvpn state

This commit is contained in:
Quentin McGaw (desktop)
2021-07-23 20:41:45 +00:00
parent fa6ccb08bd
commit 253310bd1a
16 changed files with 374 additions and 218 deletions

16
internal/loopstate/set.go Normal file
View File

@@ -0,0 +1,16 @@
package loopstate
import "github.com/qdm12/gluetun/internal/models"
type Setter interface {
SetStatus(status models.LoopStatus)
}
// SetStatus sets the status thread safely.
// It should only be called by the loop internal code since
// it does not interact with the loop code directly.
func (s *State) SetStatus(status models.LoopStatus) {
s.statusMu.Lock()
defer s.statusMu.Unlock()
s.status = status
}