forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ice_go.go
34 lines (30 loc) · 921 Bytes
/
ice_go.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +build !js
package webrtc
import "github.com/pion/sdp/v2"
// NewICETransport creates a new NewICETransport.
// This constructor is part of the ORTC API. It is not
// meant to be used together with the basic WebRTC API.
func (api *API) NewICETransport(gatherer *ICEGatherer) *ICETransport {
return NewICETransport(gatherer, api.settingEngine.LoggerFactory)
}
func newICECandidateFromSDP(c sdp.ICECandidate) (ICECandidate, error) {
typ, err := NewICECandidateType(c.Typ)
if err != nil {
return ICECandidate{}, err
}
protocol, err := NewICEProtocol(c.Protocol)
if err != nil {
return ICECandidate{}, err
}
return ICECandidate{
Foundation: c.Foundation,
Priority: c.Priority,
Address: c.Address,
Protocol: protocol,
Port: c.Port,
Component: c.Component,
Typ: typ,
RelatedAddress: c.RelatedAddress,
RelatedPort: c.RelatedPort,
}, nil
}