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

Method GetExtension

candidate_base.go:634–653  ·  view source on GitHub ↗

Get returns the value of the given key if it exists.

(key string)

Source from the content-addressed store, hash-verified

632
633// Get returns the value of the given key if it exists.
634func (c *candidateBase) GetExtension(key string) (CandidateExtension, bool) {
635 extension := CandidateExtension{Key: key}
636
637 for i := range c.extensions {
638 if c.extensions[i].Key == key {
639 extension.Value = c.extensions[i].Value
640
641 return extension, true
642 }
643 }
644
645 // TCPType was manually set.
646 if key == "tcptype" && c.TCPType() != TCPTypeUnspecified { //nolint:goconst
647 extension.Value = c.TCPType().String()
648
649 return extension, true
650 }
651
652 return extension, false
653}
654
655func (c *candidateBase) AddExtension(ext CandidateExtension) error {
656 if ext.Key == "tcptype" {

Callers

nothing calls this directly

Calls 2

TCPTypeMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected