summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/ice/v2/candidaterelatedaddress.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pion/ice/v2/candidaterelatedaddress.go')
-rw-r--r--vendor/github.com/pion/ice/v2/candidaterelatedaddress.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/pion/ice/v2/candidaterelatedaddress.go b/vendor/github.com/pion/ice/v2/candidaterelatedaddress.go
new file mode 100644
index 0000000..18cf318
--- /dev/null
+++ b/vendor/github.com/pion/ice/v2/candidaterelatedaddress.go
@@ -0,0 +1,30 @@
+package ice
+
+import "fmt"
+
+// CandidateRelatedAddress convey transport addresses related to the
+// candidate, useful for diagnostics and other purposes.
+type CandidateRelatedAddress struct {
+ Address string
+ Port int
+}
+
+// String makes CandidateRelatedAddress printable
+func (c *CandidateRelatedAddress) String() string {
+ if c == nil {
+ return ""
+ }
+
+ return fmt.Sprintf(" related %s:%d", c.Address, c.Port)
+}
+
+// Equal allows comparing two CandidateRelatedAddresses.
+// The CandidateRelatedAddress are allowed to be nil.
+func (c *CandidateRelatedAddress) Equal(other *CandidateRelatedAddress) bool {
+ if c == nil && other == nil {
+ return true
+ }
+ return c != nil && other != nil &&
+ c.Address == other.Address &&
+ c.Port == other.Port
+}