mirror of
https://github.com/pion/ice.git
synced 2025-10-06 16:07:08 +08:00
IP -> Address in public API
ICE RFC specifies this value as `Address` and not IP. We need to fix this divergence to implement mDNS Relates to pion/webrtc#699
This commit is contained in:
8
agent.go
8
agent.go
@@ -695,7 +695,7 @@ func (a *Agent) findRemoteCandidate(networkType NetworkType, addr net.Addr) Cand
|
|||||||
|
|
||||||
set := a.remoteCandidates[networkType]
|
set := a.remoteCandidates[networkType]
|
||||||
for _, c := range set {
|
for _, c := range set {
|
||||||
if c.IP().Equal(ip) && c.Port() == port {
|
if c.Address() == ip.String() && c.Port() == port {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -725,8 +725,8 @@ func (a *Agent) sendBindingSuccess(m *stun.Message, local, remote Candidate) {
|
|||||||
base := remote
|
base := remote
|
||||||
if out, err := stun.Build(m, stun.BindingSuccess,
|
if out, err := stun.Build(m, stun.BindingSuccess,
|
||||||
&stun.XORMappedAddress{
|
&stun.XORMappedAddress{
|
||||||
IP: base.IP(),
|
IP: base.addr().IP,
|
||||||
Port: base.Port(),
|
Port: base.addr().Port,
|
||||||
},
|
},
|
||||||
stun.NewShortTermIntegrity(a.localPwd),
|
stun.NewShortTermIntegrity(a.localPwd),
|
||||||
stun.Fingerprint,
|
stun.Fingerprint,
|
||||||
@@ -809,7 +809,7 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
prflxCandidate, err := NewCandidatePeerReflexive(networkType.String(), ip, port, local.Component(), "", 0)
|
prflxCandidate, err := NewCandidatePeerReflexive(networkType.String(), ip.String(), port, local.Component(), "", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.Errorf("Failed to create new remote prflx candidate (%s)", err)
|
a.log.Errorf("Failed to create new remote prflx candidate (%s)", err)
|
||||||
return
|
return
|
||||||
|
@@ -63,7 +63,7 @@ func TestPairPriority(t *testing.T) {
|
|||||||
|
|
||||||
hostLocal, err := NewCandidateHost(
|
hostLocal, err := NewCandidateHost(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("192.168.1.1"), 19216,
|
"192.168.1.1", 19216,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -72,7 +72,7 @@ func TestPairPriority(t *testing.T) {
|
|||||||
|
|
||||||
relayRemote, err := NewCandidateRelay(
|
relayRemote, err := NewCandidateRelay(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("1.2.3.4"), 12340,
|
"1.2.3.4", 12340,
|
||||||
1,
|
1,
|
||||||
"4.3.2.1", 43210,
|
"4.3.2.1", 43210,
|
||||||
)
|
)
|
||||||
@@ -82,7 +82,7 @@ func TestPairPriority(t *testing.T) {
|
|||||||
|
|
||||||
srflxRemote, err := NewCandidateServerReflexive(
|
srflxRemote, err := NewCandidateServerReflexive(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("10.10.10.2"), 19218,
|
"10.10.10.2", 19218,
|
||||||
1,
|
1,
|
||||||
"4.3.2.1", 43212,
|
"4.3.2.1", 43212,
|
||||||
)
|
)
|
||||||
@@ -92,7 +92,7 @@ func TestPairPriority(t *testing.T) {
|
|||||||
|
|
||||||
prflxRemote, err := NewCandidatePeerReflexive(
|
prflxRemote, err := NewCandidatePeerReflexive(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("10.10.10.2"), 19217,
|
"10.10.10.2", 19217,
|
||||||
1,
|
1,
|
||||||
"4.3.2.1", 43211,
|
"4.3.2.1", 43211,
|
||||||
)
|
)
|
||||||
@@ -102,7 +102,7 @@ func TestPairPriority(t *testing.T) {
|
|||||||
|
|
||||||
hostRemote, err := NewCandidateHost(
|
hostRemote, err := NewCandidateHost(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("1.2.3.5"), 12350,
|
"1.2.3.5", 12350,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -145,7 +145,7 @@ func TestOnSelectedCandidatePairChange(t *testing.T) {
|
|||||||
|
|
||||||
hostLocal, err := NewCandidateHost(
|
hostLocal, err := NewCandidateHost(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("192.168.1.1"), 19216,
|
"192.168.1.1", 19216,
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -154,7 +154,7 @@ func TestOnSelectedCandidatePairChange(t *testing.T) {
|
|||||||
|
|
||||||
relayRemote, err := NewCandidateRelay(
|
relayRemote, err := NewCandidateRelay(
|
||||||
"udp",
|
"udp",
|
||||||
net.ParseIP("1.2.3.4"), 12340,
|
"1.2.3.4", 12340,
|
||||||
1,
|
1,
|
||||||
"4.3.2.1", 43210,
|
"4.3.2.1", 43210,
|
||||||
)
|
)
|
||||||
@@ -204,8 +204,7 @@ func TestHandlePeerReflexive(t *testing.T) {
|
|||||||
var config AgentConfig
|
var config AgentConfig
|
||||||
runAgentTest(t, &config, func(a *Agent) {
|
runAgentTest(t, &config, func(a *Agent) {
|
||||||
a.selector = &controllingSelector{agent: a, log: a.log}
|
a.selector = &controllingSelector{agent: a, log: a.log}
|
||||||
ip := net.ParseIP("192.168.0.2")
|
local, err := NewCandidateHost("udp", "192.168.0.2", 777, 1)
|
||||||
local, err := NewCandidateHost("udp", ip, 777, 1)
|
|
||||||
local.conn = &mockPacketConn{}
|
local.conn = &mockPacketConn{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create a new candidate: %v", err)
|
t.Fatalf("failed to create a new candidate: %v", err)
|
||||||
@@ -244,7 +243,7 @@ func TestHandlePeerReflexive(t *testing.T) {
|
|||||||
t.Fatal("candidate type must be prflx")
|
t.Fatal("candidate type must be prflx")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.IP().Equal(net.ParseIP("172.17.0.3")) {
|
if c.Address() != "172.17.0.3" {
|
||||||
t.Fatal("IP address mismatch")
|
t.Fatal("IP address mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +262,7 @@ func TestHandlePeerReflexive(t *testing.T) {
|
|||||||
var config AgentConfig
|
var config AgentConfig
|
||||||
runAgentTest(t, &config, func(a *Agent) {
|
runAgentTest(t, &config, func(a *Agent) {
|
||||||
a.selector = &controllingSelector{agent: a, log: a.log}
|
a.selector = &controllingSelector{agent: a, log: a.log}
|
||||||
ip := net.ParseIP("192.168.0.2")
|
local, err := NewCandidateHost("tcp", "192.168.0.2", 777, 1)
|
||||||
local, err := NewCandidateHost("tcp", ip, 777, 1)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create a new candidate: %v", err)
|
t.Fatalf("failed to create a new candidate: %v", err)
|
||||||
}
|
}
|
||||||
@@ -294,7 +292,7 @@ func TestHandlePeerReflexive(t *testing.T) {
|
|||||||
{tID, &net.UDPAddr{}, false},
|
{tID, &net.UDPAddr{}, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
local, err := NewCandidateHost("udp", net.ParseIP("192.168.0.2"), 777, 1)
|
local, err := NewCandidateHost("udp", "192.168.0.2", 777, 1)
|
||||||
local.conn = &mockPacketConn{}
|
local.conn = &mockPacketConn{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create a new candidate: %v", err)
|
t.Fatalf("failed to create a new candidate: %v", err)
|
||||||
@@ -373,7 +371,7 @@ func TestInboundValidity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remote := &net.UDPAddr{IP: net.ParseIP("172.17.0.3"), Port: 999}
|
remote := &net.UDPAddr{IP: net.ParseIP("172.17.0.3"), Port: 999}
|
||||||
local, err := NewCandidateHost("udp", net.ParseIP("192.168.0.2"), 777, 1)
|
local, err := NewCandidateHost("udp", "192.168.0.2", 777, 1)
|
||||||
local.conn = &mockPacketConn{}
|
local.conn = &mockPacketConn{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create a new candidate: %v", err)
|
t.Fatalf("failed to create a new candidate: %v", err)
|
||||||
@@ -464,7 +462,7 @@ func TestInboundValidity(t *testing.T) {
|
|||||||
t.Fatalf("Error constructing ice.Agent")
|
t.Fatalf("Error constructing ice.Agent")
|
||||||
}
|
}
|
||||||
|
|
||||||
local, err := NewCandidateHost("udp", net.ParseIP("192.168.0.2"), 777, 1)
|
local, err := NewCandidateHost("udp", "192.168.0.2", 777, 1)
|
||||||
local.conn = &mockPacketConn{}
|
local.conn = &mockPacketConn{}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create a new candidate: %v", err)
|
t.Fatalf("failed to create a new candidate: %v", err)
|
||||||
|
@@ -18,7 +18,7 @@ const (
|
|||||||
// Candidate represents an ICE candidate
|
// Candidate represents an ICE candidate
|
||||||
type Candidate interface {
|
type Candidate interface {
|
||||||
Component() uint16
|
Component() uint16
|
||||||
IP() net.IP
|
Address() string
|
||||||
LastReceived() time.Time
|
LastReceived() time.Time
|
||||||
LastSent() time.Time
|
LastSent() time.Time
|
||||||
NetworkType() NetworkType
|
NetworkType() NetworkType
|
||||||
@@ -30,7 +30,7 @@ type Candidate interface {
|
|||||||
|
|
||||||
Equal(other Candidate) bool
|
Equal(other Candidate) bool
|
||||||
|
|
||||||
addr() net.Addr
|
addr() *net.UDPAddr
|
||||||
agent() *Agent
|
agent() *Agent
|
||||||
|
|
||||||
close() error
|
close() error
|
||||||
|
@@ -15,10 +15,12 @@ type candidateBase struct {
|
|||||||
candidateType CandidateType
|
candidateType CandidateType
|
||||||
|
|
||||||
component uint16
|
component uint16
|
||||||
ip net.IP
|
address string
|
||||||
port int
|
port int
|
||||||
relatedAddress *CandidateRelatedAddress
|
relatedAddress *CandidateRelatedAddress
|
||||||
|
|
||||||
|
resolvedAddr *net.UDPAddr
|
||||||
|
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
lastSent time.Time
|
lastSent time.Time
|
||||||
lastReceived time.Time
|
lastReceived time.Time
|
||||||
@@ -29,9 +31,9 @@ type candidateBase struct {
|
|||||||
closedCh chan struct{}
|
closedCh chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IP returns Candidate IP
|
// Address returns Candidate Address
|
||||||
func (c *candidateBase) IP() net.IP {
|
func (c *candidateBase) Address() string {
|
||||||
return c.ip
|
return c.address
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port returns Candidate Port
|
// Port returns Candidate Port
|
||||||
@@ -176,14 +178,14 @@ func (c *candidateBase) Priority() uint32 {
|
|||||||
func (c *candidateBase) Equal(other Candidate) bool {
|
func (c *candidateBase) Equal(other Candidate) bool {
|
||||||
return c.NetworkType() == other.NetworkType() &&
|
return c.NetworkType() == other.NetworkType() &&
|
||||||
c.Type() == other.Type() &&
|
c.Type() == other.Type() &&
|
||||||
c.IP().Equal(other.IP()) &&
|
c.Address() == other.Address() &&
|
||||||
c.Port() == other.Port() &&
|
c.Port() == other.Port() &&
|
||||||
c.RelatedAddress().Equal(other.RelatedAddress())
|
c.RelatedAddress().Equal(other.RelatedAddress())
|
||||||
}
|
}
|
||||||
|
|
||||||
// String makes the candidateBase printable
|
// String makes the candidateBase printable
|
||||||
func (c *candidateBase) String() string {
|
func (c *candidateBase) String() string {
|
||||||
return fmt.Sprintf("%s %s:%d%s", c.Type(), c.IP(), c.Port(), c.relatedAddress)
|
return fmt.Sprintf("%s %s:%d%s", c.Type(), c.Address(), c.Port(), c.relatedAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastReceived returns a time.Time indicating the last time
|
// LastReceived returns a time.Time indicating the last time
|
||||||
@@ -222,11 +224,10 @@ func (c *candidateBase) seen(outbound bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *candidateBase) addr() net.Addr {
|
func (c *candidateBase) addr() *net.UDPAddr {
|
||||||
return &net.UDPAddr{
|
c.lock.Lock()
|
||||||
IP: c.IP(),
|
defer c.lock.Unlock()
|
||||||
Port: c.Port(),
|
return c.resolvedAddr
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *candidateBase) agent() *Agent {
|
func (c *candidateBase) agent() *Agent {
|
||||||
|
@@ -2,6 +2,7 @@ package ice
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CandidateHost is a candidate of type host
|
// CandidateHost is a candidate of type host
|
||||||
@@ -10,19 +11,28 @@ type CandidateHost struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewCandidateHost creates a new host candidate
|
// NewCandidateHost creates a new host candidate
|
||||||
func NewCandidateHost(network string, ip net.IP, port int, component uint16) (*CandidateHost, error) {
|
func NewCandidateHost(network string, address string, port int, component uint16) (*CandidateHost, error) {
|
||||||
networkType, err := determineNetworkType(network, ip)
|
c := &CandidateHost{
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &CandidateHost{
|
|
||||||
candidateBase: candidateBase{
|
candidateBase: candidateBase{
|
||||||
networkType: networkType,
|
|
||||||
candidateType: CandidateTypeHost,
|
candidateType: CandidateTypeHost,
|
||||||
ip: ip,
|
|
||||||
port: port,
|
port: port,
|
||||||
component: component,
|
component: component,
|
||||||
},
|
},
|
||||||
}, nil
|
}
|
||||||
|
if !strings.HasSuffix(address, ".local") {
|
||||||
|
ip := net.ParseIP(address)
|
||||||
|
if ip == nil {
|
||||||
|
return nil, ErrAddressParseFailed
|
||||||
|
}
|
||||||
|
|
||||||
|
networkType, err := determineNetworkType(network, ip)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
c.candidateBase.networkType = networkType
|
||||||
|
c.candidateBase.resolvedAddr = &net.UDPAddr{IP: ip, Port: port}
|
||||||
|
}
|
||||||
|
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,12 @@ type CandidatePeerReflexive struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewCandidatePeerReflexive creates a new peer reflective candidate
|
// NewCandidatePeerReflexive creates a new peer reflective candidate
|
||||||
func NewCandidatePeerReflexive(network string, ip net.IP, port int, component uint16, relAddr string, relPort int) (*CandidatePeerReflexive, error) {
|
func NewCandidatePeerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidatePeerReflexive, error) {
|
||||||
|
ip := net.ParseIP(address)
|
||||||
|
if ip == nil {
|
||||||
|
return nil, ErrAddressParseFailed
|
||||||
|
}
|
||||||
|
|
||||||
networkType, err := determineNetworkType(network, ip)
|
networkType, err := determineNetworkType(network, ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -18,8 +23,9 @@ func NewCandidatePeerReflexive(network string, ip net.IP, port int, component ui
|
|||||||
candidateBase: candidateBase{
|
candidateBase: candidateBase{
|
||||||
networkType: networkType,
|
networkType: networkType,
|
||||||
candidateType: CandidateTypePeerReflexive,
|
candidateType: CandidateTypePeerReflexive,
|
||||||
ip: ip,
|
address: address,
|
||||||
port: port,
|
port: port,
|
||||||
|
resolvedAddr: &net.UDPAddr{IP: ip, Port: port},
|
||||||
component: component,
|
component: component,
|
||||||
relatedAddress: &CandidateRelatedAddress{
|
relatedAddress: &CandidateRelatedAddress{
|
||||||
Address: relAddr,
|
Address: relAddr,
|
||||||
|
@@ -18,7 +18,12 @@ type CandidateRelay struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewCandidateRelay creates a new relay candidate
|
// NewCandidateRelay creates a new relay candidate
|
||||||
func NewCandidateRelay(network string, ip net.IP, port int, component uint16, relAddr string, relPort int) (*CandidateRelay, error) {
|
func NewCandidateRelay(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateRelay, error) {
|
||||||
|
ip := net.ParseIP(address)
|
||||||
|
if ip == nil {
|
||||||
|
return nil, ErrAddressParseFailed
|
||||||
|
}
|
||||||
|
|
||||||
networkType, err := determineNetworkType(network, ip)
|
networkType, err := determineNetworkType(network, ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -28,8 +33,9 @@ func NewCandidateRelay(network string, ip net.IP, port int, component uint16, re
|
|||||||
candidateBase: candidateBase{
|
candidateBase: candidateBase{
|
||||||
networkType: networkType,
|
networkType: networkType,
|
||||||
candidateType: CandidateTypeRelay,
|
candidateType: CandidateTypeRelay,
|
||||||
ip: ip,
|
address: address,
|
||||||
port: port,
|
port: port,
|
||||||
|
resolvedAddr: &net.UDPAddr{IP: ip, Port: port},
|
||||||
component: component,
|
component: component,
|
||||||
relatedAddress: &CandidateRelatedAddress{
|
relatedAddress: &CandidateRelatedAddress{
|
||||||
Address: relAddr,
|
Address: relAddr,
|
||||||
|
@@ -8,7 +8,12 @@ type CandidateServerReflexive struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewCandidateServerReflexive creates a new server reflective candidate
|
// NewCandidateServerReflexive creates a new server reflective candidate
|
||||||
func NewCandidateServerReflexive(network string, ip net.IP, port int, component uint16, relAddr string, relPort int) (*CandidateServerReflexive, error) {
|
func NewCandidateServerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateServerReflexive, error) {
|
||||||
|
ip := net.ParseIP(address)
|
||||||
|
if ip == nil {
|
||||||
|
return nil, ErrAddressParseFailed
|
||||||
|
}
|
||||||
|
|
||||||
networkType, err := determineNetworkType(network, ip)
|
networkType, err := determineNetworkType(network, ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -18,8 +23,9 @@ func NewCandidateServerReflexive(network string, ip net.IP, port int, component
|
|||||||
candidateBase: candidateBase{
|
candidateBase: candidateBase{
|
||||||
networkType: networkType,
|
networkType: networkType,
|
||||||
candidateType: CandidateTypeServerReflexive,
|
candidateType: CandidateTypeServerReflexive,
|
||||||
ip: ip,
|
address: address,
|
||||||
port: port,
|
port: port,
|
||||||
|
resolvedAddr: &net.UDPAddr{IP: ip, Port: port},
|
||||||
component: component,
|
component: component,
|
||||||
relatedAddress: &CandidateRelatedAddress{
|
relatedAddress: &CandidateRelatedAddress{
|
||||||
Address: relAddr,
|
Address: relAddr,
|
||||||
|
@@ -54,4 +54,7 @@ var (
|
|||||||
|
|
||||||
// ErrPasswordEmpty indicates agent was give TURN URL with an empty Password
|
// ErrPasswordEmpty indicates agent was give TURN URL with an empty Password
|
||||||
ErrPasswordEmpty = errors.New("password is empty")
|
ErrPasswordEmpty = errors.New("password is empty")
|
||||||
|
|
||||||
|
// ErrAddressParseFailed indicates we were unable to parse a candidate address
|
||||||
|
ErrAddressParseFailed = errors.New("failed to parse address")
|
||||||
)
|
)
|
||||||
|
@@ -177,7 +177,7 @@ func (a *Agent) gatherCandidatesLocal(networkTypes []NetworkType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
port := conn.LocalAddr().(*net.UDPAddr).Port
|
port := conn.LocalAddr().(*net.UDPAddr).Port
|
||||||
c, err := NewCandidateHost(network, ip, port, ComponentRTP)
|
c, err := NewCandidateHost(network, ip.String(), port, ComponentRTP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.Warnf("Failed to create host candidate: %s %s %d: %v\n", network, ip, port, err)
|
a.log.Warnf("Failed to create host candidate: %s %s %d: %v\n", network, ip, port, err)
|
||||||
return
|
return
|
||||||
@@ -237,7 +237,7 @@ func (a *Agent) gatherCandidatesSrflx(urls []*URL, networkTypes []NetworkType) {
|
|||||||
port := xoraddr.Port
|
port := xoraddr.Port
|
||||||
relIP := laddr.IP.String()
|
relIP := laddr.IP.String()
|
||||||
relPort := laddr.Port
|
relPort := laddr.Port
|
||||||
c, err := NewCandidateServerReflexive(network, ip, port, ComponentRTP, relIP, relPort)
|
c, err := NewCandidateServerReflexive(network, ip.String(), port, ComponentRTP, relIP, relPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err)
|
a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err)
|
||||||
continue
|
continue
|
||||||
@@ -302,7 +302,7 @@ func (a *Agent) gatherCandidatesRelay(urls []*URL) error {
|
|||||||
ip := allocation.Relayed().IP
|
ip := allocation.Relayed().IP
|
||||||
port := allocation.Relayed().Port
|
port := allocation.Relayed().Port
|
||||||
|
|
||||||
candidate, err := NewCandidateRelay(network, ip, port, ComponentRTP, laddr.IP.String(), laddr.Port)
|
candidate, err := NewCandidateRelay(network, ip.String(), port, ComponentRTP, laddr.IP.String(), laddr.Port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err)
|
a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err)
|
||||||
continue
|
continue
|
||||||
|
@@ -337,7 +337,7 @@ func copyCandidate(o Candidate) Candidate {
|
|||||||
candidateBase{
|
candidateBase{
|
||||||
candidateType: orig.candidateType,
|
candidateType: orig.candidateType,
|
||||||
networkType: orig.networkType,
|
networkType: orig.networkType,
|
||||||
ip: orig.ip,
|
address: orig.address,
|
||||||
port: orig.port,
|
port: orig.port,
|
||||||
component: orig.component,
|
component: orig.component,
|
||||||
},
|
},
|
||||||
@@ -347,7 +347,7 @@ func copyCandidate(o Candidate) Candidate {
|
|||||||
candidateBase{
|
candidateBase{
|
||||||
candidateType: orig.candidateType,
|
candidateType: orig.candidateType,
|
||||||
networkType: orig.networkType,
|
networkType: orig.networkType,
|
||||||
ip: orig.ip,
|
address: orig.address,
|
||||||
port: orig.port,
|
port: orig.port,
|
||||||
component: orig.component,
|
component: orig.component,
|
||||||
relatedAddress: orig.relatedAddress,
|
relatedAddress: orig.relatedAddress,
|
||||||
@@ -359,7 +359,7 @@ func copyCandidate(o Candidate) Candidate {
|
|||||||
candidateBase{
|
candidateBase{
|
||||||
candidateType: orig.candidateType,
|
candidateType: orig.candidateType,
|
||||||
networkType: orig.networkType,
|
networkType: orig.networkType,
|
||||||
ip: orig.ip,
|
address: orig.address,
|
||||||
port: orig.port,
|
port: orig.port,
|
||||||
component: orig.component,
|
component: orig.component,
|
||||||
relatedAddress: orig.relatedAddress,
|
relatedAddress: orig.relatedAddress,
|
||||||
|
Reference in New Issue
Block a user