()
| 610 | } |
| 611 | |
| 612 | func (c *candidateBase) Extensions() []CandidateExtension { |
| 613 | tcpType := c.TCPType() |
| 614 | hasTCPType := 0 |
| 615 | if tcpType != TCPTypeUnspecified { |
| 616 | hasTCPType = 1 |
| 617 | } |
| 618 | |
| 619 | extensions := make([]CandidateExtension, len(c.extensions)+hasTCPType) |
| 620 | // We store the TCPType in c.tcpType, but we need to return it as an extension. |
| 621 | if hasTCPType == 1 { |
| 622 | extensions[0] = CandidateExtension{ |
| 623 | Key: "tcptype", |
| 624 | Value: tcpType.String(), |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | copy(extensions[hasTCPType:], c.extensions) |
| 629 | |
| 630 | return extensions |
| 631 | } |
| 632 | |
| 633 | // Get returns the value of the given key if it exists. |
| 634 | func (c *candidateBase) GetExtension(key string) (CandidateExtension, bool) { |
no test coverage detected