Code refactoring

This commit is contained in:
Alexey Khit
2023-01-14 09:04:54 +03:00
parent 331c5bbcad
commit a06462729d
+8 -8
View File
@@ -25,18 +25,18 @@ func NewCandidate(network, address string) (string, error) {
return "", err
}
tcpType := ice.TCPTypeUnspecified
if network == "tcp" {
tcpType = ice.TCPTypePassive
}
cand, err := ice.NewCandidateHost(&ice.CandidateHostConfig{
config := &ice.CandidateHostConfig{
Network: network,
Address: host,
Port: i,
Component: ice.ComponentRTP,
TCPType: tcpType,
})
}
if network == "udp" {
config.TCPType = ice.TCPTypePassive
}
cand, err := ice.NewCandidateHost(config)
if err != nil {
return "", err
}