atomicutil: use atomicutil.Value wherever possible (#3517)

* atomicutil: use atomicutil.Value wherever possible

* fix test

* fix mux router
This commit is contained in:
Caleb Doxsey 2022-07-28 15:38:38 -06:00 committed by GitHub
parent 5c14d2c994
commit 0ac7e45a21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 121 additions and 215 deletions

View file

@ -3,7 +3,6 @@ package proxy
import (
"crypto/cipher"
"net/url"
"sync/atomic"
"github.com/pomerium/pomerium/config"
"github.com/pomerium/pomerium/internal/encoding"
@ -94,21 +93,3 @@ func newProxyStateFromConfig(cfg *config.Config) (*proxyState, error) {
return state, nil
}
type atomicProxyState struct {
value atomic.Value
}
func newAtomicProxyState(state *proxyState) *atomicProxyState {
aps := new(atomicProxyState)
aps.Store(state)
return aps
}
func (aps *atomicProxyState) Load() *proxyState {
return aps.value.Load().(*proxyState)
}
func (aps *atomicProxyState) Store(state *proxyState) {
aps.value.Store(state)
}