mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-28 20:40:06 +00:00
Add optional DTLS role config param
This commit is contained in:
parent
24ff0f2ea2
commit
589cda91f4
3 changed files with 14 additions and 0 deletions
|
|
@ -252,6 +252,13 @@ webrtc:
|
|||
# turn off default Pion interceptors (see: https://github.com/pion/interceptor)
|
||||
# (performance)
|
||||
disableDefaultInterceptors:
|
||||
# indicates the role of the DTLS transport (see: https://github.com/pion/webrtc/blob/master/dtlsrole.go)
|
||||
# (debug)
|
||||
# - (default)
|
||||
# - 1 (auto)
|
||||
# - 2 (client)
|
||||
# - 3 (server)
|
||||
dtlsRole:
|
||||
# a list of STUN/TURN servers to use
|
||||
iceServers:
|
||||
- url: stun:stun.l.google.com:19302
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import "github.com/giongto35/cloud-game/v2/pkg/config/encoder"
|
|||
|
||||
type Webrtc struct {
|
||||
DisableDefaultInterceptors bool
|
||||
DtlsRole byte
|
||||
IceServers []IceServer
|
||||
IcePorts struct {
|
||||
Min uint16
|
||||
|
|
|
|||
|
|
@ -36,6 +36,12 @@ func DefaultPeerConnection(conf conf.Webrtc) (*PeerConnection, error) {
|
|||
|
||||
settingsOnce.Do(func() {
|
||||
settingEngine := pion.SettingEngine{}
|
||||
if conf.DtlsRole > 0 {
|
||||
log.Printf("A custom DTLS role [%v]", conf.DtlsRole)
|
||||
if err := settingEngine.SetAnsweringDTLSRole(pion.DTLSRole(conf.DtlsRole)); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
if conf.IcePorts.Min > 0 && conf.IcePorts.Max > 0 {
|
||||
if err := settingEngine.SetEphemeralUDPPortRange(conf.IcePorts.Min, conf.IcePorts.Max); err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue