(t *testing.T)
| 492 | } |
| 493 | |
| 494 | func TestMultipleConfigOptions(t *testing.T) { |
| 495 | t.Run("can apply multiple options", func(t *testing.T) { |
| 496 | customOffset := uint16(100) |
| 497 | handlerCalled := false |
| 498 | handler := func(_ *stun.Message, _, _ Candidate, _ *CandidatePair) bool { |
| 499 | handlerCalled = true |
| 500 | |
| 501 | return true |
| 502 | } |
| 503 | |
| 504 | agent, err := NewAgentWithOptions( |
| 505 | WithIncludeLoopback(), |
| 506 | WithTCPPriorityOffset(customOffset), |
| 507 | WithDisableActiveTCP(), |
| 508 | WithBindingRequestHandler(handler), |
| 509 | WithEnableUseCandidateCheckPriority(), |
| 510 | ) |
| 511 | assert.NoError(t, err) |
| 512 | defer agent.Close() //nolint:errcheck |
| 513 | |
| 514 | assert.True(t, agent.includeLoopback) |
| 515 | assert.Equal(t, customOffset, agent.tcpPriorityOffset) |
| 516 | assert.True(t, agent.disableActiveTCP) |
| 517 | assert.NotNil(t, agent.userBindingRequestHandler) |
| 518 | assert.True(t, agent.enableUseCandidateCheckPriority) |
| 519 | |
| 520 | if agent.userBindingRequestHandler != nil { |
| 521 | agent.userBindingRequestHandler(nil, nil, nil, nil) |
| 522 | assert.True(t, handlerCalled) |
| 523 | } |
| 524 | }) |
| 525 | } |
| 526 | |
| 527 | func TestWithInterfaceFilter(t *testing.T) { |
| 528 | t.Run("sets interface filter", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…