forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ice_go.go
55 lines (50 loc) · 1.73 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// +build !js
package webrtc
import "github.com/pion/sdp/v2"
// NewICEGatherer creates a new NewICEGatherer.
// This constructor is part of the ORTC API. It is not
// meant to be used together with the basic WebRTC API.
func (api *API) NewICEGatherer(opts ICEGatherOptions) (*ICEGatherer, error) {
return NewICEGatherer(
api.settingEngine.ephemeralUDP.PortMin,
api.settingEngine.ephemeralUDP.PortMax,
api.settingEngine.timeout.ICEConnection,
api.settingEngine.timeout.ICEKeepalive,
api.settingEngine.timeout.ICECandidateSelectionTimeout,
api.settingEngine.timeout.ICEHostAcceptanceMinWait,
api.settingEngine.timeout.ICESrflxAcceptanceMinWait,
api.settingEngine.timeout.ICEPrflxAcceptanceMinWait,
api.settingEngine.timeout.ICERelayAcceptanceMinWait,
api.settingEngine.LoggerFactory,
api.settingEngine.candidates.ICETrickle,
api.settingEngine.candidates.ICENetworkTypes,
opts,
)
}
// 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
}