MCPcopy Create free account
hub / github.com/pion/ice / initWithDefaults

Method initWithDefaults

agent_config.go:250–322  ·  view source on GitHub ↗

initWithDefaults populates an agent and falls back to defaults if fields are unset.

(agent *Agent)

Source from the content-addressed store, hash-verified

248
249// initWithDefaults populates an agent and falls back to defaults if fields are unset.
250func (config *AgentConfig) initWithDefaults(agent *Agent) { //nolint:cyclop
251 if config.MaxBindingRequests == nil {
252 agent.maxBindingRequests = defaultMaxBindingRequests
253 } else {
254 agent.maxBindingRequests = *config.MaxBindingRequests
255 }
256
257 if config.HostAcceptanceMinWait == nil {
258 agent.hostAcceptanceMinWait = defaultHostAcceptanceMinWait
259 } else {
260 agent.hostAcceptanceMinWait = *config.HostAcceptanceMinWait
261 }
262
263 if config.SrflxAcceptanceMinWait == nil {
264 agent.srflxAcceptanceMinWait = defaultSrflxAcceptanceMinWait
265 } else {
266 agent.srflxAcceptanceMinWait = *config.SrflxAcceptanceMinWait
267 }
268
269 if config.PrflxAcceptanceMinWait == nil {
270 agent.prflxAcceptanceMinWait = defaultPrflxAcceptanceMinWait
271 } else {
272 agent.prflxAcceptanceMinWait = *config.PrflxAcceptanceMinWait
273 }
274
275 if config.RelayAcceptanceMinWait == nil {
276 agent.relayAcceptanceMinWait = defaultRelayAcceptanceMinWaitFor(config.CandidateTypes)
277 } else {
278 agent.relayAcceptanceMinWait = *config.RelayAcceptanceMinWait
279 }
280
281 if config.STUNGatherTimeout == nil {
282 agent.stunGatherTimeout = defaultSTUNGatherTimeout
283 } else {
284 agent.stunGatherTimeout = *config.STUNGatherTimeout
285 }
286
287 if config.TCPPriorityOffset == nil {
288 agent.tcpPriorityOffset = defaultTCPPriorityOffset
289 } else {
290 agent.tcpPriorityOffset = *config.TCPPriorityOffset
291 }
292
293 if config.DisconnectedTimeout == nil {
294 agent.disconnectedTimeout = defaultDisconnectedTimeout
295 } else {
296 agent.disconnectedTimeout = *config.DisconnectedTimeout
297 }
298
299 if config.FailedTimeout == nil {
300 agent.failedTimeout = defaultFailedTimeout
301 } else {
302 agent.failedTimeout = *config.FailedTimeout
303 }
304
305 if config.KeepaliveInterval == nil {
306 agent.keepaliveInterval = defaultKeepaliveInterval
307 } else {

Calls 2

defaultCandidateTypesFunction · 0.85