MCPcopy
hub / github.com/cloudflare/cloudflared / newRemoteProtocolSelector

Function newRemoteProtocolSelector

connection/protocol.go:138–155  ·  view source on GitHub ↗
(
	current Protocol,
	protocolPool []Protocol,
	switchThreshold int32,
	fetchFunc edgediscovery.PercentageFetcher,
	ttl time.Duration,
	log *zerolog.Logger,
)

Source from the content-addressed store, hash-verified

136}
137
138func newRemoteProtocolSelector(
139 current Protocol,
140 protocolPool []Protocol,
141 switchThreshold int32,
142 fetchFunc edgediscovery.PercentageFetcher,
143 ttl time.Duration,
144 log *zerolog.Logger,
145) *remoteProtocolSelector {
146 return &remoteProtocolSelector{
147 current: current,
148 protocolPool: protocolPool,
149 switchThreshold: switchThreshold,
150 fetchFunc: fetchFunc,
151 refreshAfter: time.Now().Add(ttl),
152 ttl: ttl,
153 log: log,
154 }
155}
156
157func (s *remoteProtocolSelector) Current() Protocol {
158 s.lock.Lock()

Callers 1

NewProtocolSelectorFunction · 0.85

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected