usecandidate.go 681 B

1234567891011121314151617181920212223242526
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package ice
  4. import "github.com/pion/stun"
  5. // UseCandidateAttr represents USE-CANDIDATE attribute.
  6. type UseCandidateAttr struct{}
  7. // AddTo adds USE-CANDIDATE attribute to message.
  8. func (UseCandidateAttr) AddTo(m *stun.Message) error {
  9. m.Add(stun.AttrUseCandidate, nil)
  10. return nil
  11. }
  12. // IsSet returns true if USE-CANDIDATE attribute is set.
  13. func (UseCandidateAttr) IsSet(m *stun.Message) bool {
  14. _, err := m.Get(stun.AttrUseCandidate)
  15. return err == nil
  16. }
  17. // UseCandidate is shorthand for UseCandidateAttr.
  18. func UseCandidate() UseCandidateAttr {
  19. return UseCandidateAttr{}
  20. }