mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-31 18:07:17 +02:00
atomicutil: use atomicutil.Value wherever possible (#3517)
* atomicutil: use atomicutil.Value wherever possible * fix test * fix mux router
This commit is contained in:
parent
5c14d2c994
commit
0ac7e45a21
23 changed files with 121 additions and 215 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue