Code refactoring
This commit is contained in:
@@ -25,18 +25,18 @@ func NewCandidate(network, address string) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpType := ice.TCPTypeUnspecified
|
config := &ice.CandidateHostConfig{
|
||||||
if network == "tcp" {
|
|
||||||
tcpType = ice.TCPTypePassive
|
|
||||||
}
|
|
||||||
|
|
||||||
cand, err := ice.NewCandidateHost(&ice.CandidateHostConfig{
|
|
||||||
Network: network,
|
Network: network,
|
||||||
Address: host,
|
Address: host,
|
||||||
Port: i,
|
Port: i,
|
||||||
Component: ice.ComponentRTP,
|
Component: ice.ComponentRTP,
|
||||||
TCPType: tcpType,
|
}
|
||||||
})
|
|
||||||
|
if network == "udp" {
|
||||||
|
config.TCPType = ice.TCPTypePassive
|
||||||
|
}
|
||||||
|
|
||||||
|
cand, err := ice.NewCandidateHost(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user