From a06462729d49df17ddb425ef9b885c99107837ee Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Sat, 14 Jan 2023 09:04:54 +0300 Subject: [PATCH] Code refactoring --- pkg/webrtc/helper.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/webrtc/helper.go b/pkg/webrtc/helper.go index a06256f2..e1b56ee0 100644 --- a/pkg/webrtc/helper.go +++ b/pkg/webrtc/helper.go @@ -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 }