mirror of
https://github.com/pion/webrtc.git
synced 2025-10-04 23:02:48 +08:00
Rename SettingEngine mDNS Config option
GenerateMulticastDNSCandidates -> SetICEMulticastDNSMode. Before a user wasn't able to disable mDNS. By changing it we can do more with this API.
This commit is contained in:
@@ -82,9 +82,10 @@ func (g *ICEGatherer) createAgent() error {
|
|||||||
nat1To1CandiTyp = ice.CandidateTypeUnspecified
|
nat1To1CandiTyp = ice.CandidateTypeUnspecified
|
||||||
}
|
}
|
||||||
|
|
||||||
var multicastDNSMode ice.MulticastDNSMode
|
mDNSMode := g.api.settingEngine.candidates.MulticastDNSMode
|
||||||
if g.api.settingEngine.candidates.GenerateMulticastDNSCandidates {
|
if mDNSMode != ice.MulticastDNSModeDisabled && mDNSMode != ice.MulticastDNSModeQueryAndGather {
|
||||||
multicastDNSMode = ice.MulticastDNSModeQueryAndGather
|
// If enum is in state we don't recognized default to MulticastDNSModeQueryOnly
|
||||||
|
mDNSMode = ice.MulticastDNSModeQueryOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
config := &ice.AgentConfig{
|
config := &ice.AgentConfig{
|
||||||
@@ -105,7 +106,7 @@ func (g *ICEGatherer) createAgent() error {
|
|||||||
NAT1To1IPs: g.api.settingEngine.candidates.NAT1To1IPs,
|
NAT1To1IPs: g.api.settingEngine.candidates.NAT1To1IPs,
|
||||||
NAT1To1IPCandidateType: nat1To1CandiTyp,
|
NAT1To1IPCandidateType: nat1To1CandiTyp,
|
||||||
Net: g.api.settingEngine.vnet,
|
Net: g.api.settingEngine.vnet,
|
||||||
MulticastDNSMode: multicastDNSMode,
|
MulticastDNSMode: mDNSMode,
|
||||||
MulticastDNSHostName: g.api.settingEngine.candidates.MulticastDNSHostName,
|
MulticastDNSHostName: g.api.settingEngine.candidates.MulticastDNSHostName,
|
||||||
LocalUfrag: g.api.settingEngine.candidates.UsernameFragment,
|
LocalUfrag: g.api.settingEngine.candidates.UsernameFragment,
|
||||||
LocalPwd: g.api.settingEngine.candidates.Password,
|
LocalPwd: g.api.settingEngine.candidates.Password,
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pion/ice/v2"
|
||||||
"github.com/pion/transport/test"
|
"github.com/pion/transport/test"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@@ -77,7 +78,7 @@ func TestICEGather_mDNSCandidateGathering(t *testing.T) {
|
|||||||
defer report()
|
defer report()
|
||||||
|
|
||||||
s := SettingEngine{}
|
s := SettingEngine{}
|
||||||
s.GenerateMulticastDNSCandidates(true)
|
s.SetICEMulticastDNSMode(ice.MulticastDNSModeQueryAndGather)
|
||||||
|
|
||||||
gatherer, err := NewAPI(WithSettingEngine(s)).NewICEGatherer(ICEGatherOptions{})
|
gatherer, err := NewAPI(WithSettingEngine(s)).NewICEGatherer(ICEGatherOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -838,7 +838,7 @@ func TestMulticastDNSCandidates(t *testing.T) {
|
|||||||
defer report()
|
defer report()
|
||||||
|
|
||||||
s := SettingEngine{}
|
s := SettingEngine{}
|
||||||
s.GenerateMulticastDNSCandidates(true)
|
s.SetICEMulticastDNSMode(ice.MulticastDNSModeQueryAndGather)
|
||||||
|
|
||||||
pcOffer, pcAnswer, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{})
|
pcOffer, pcAnswer, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@@ -37,7 +37,7 @@ type SettingEngine struct {
|
|||||||
InterfaceFilter func(string) bool
|
InterfaceFilter func(string) bool
|
||||||
NAT1To1IPs []string
|
NAT1To1IPs []string
|
||||||
NAT1To1IPCandidateType ICECandidateType
|
NAT1To1IPCandidateType ICECandidateType
|
||||||
GenerateMulticastDNSCandidates bool
|
MulticastDNSMode ice.MulticastDNSMode
|
||||||
MulticastDNSHostName string
|
MulticastDNSHostName string
|
||||||
UsernameFragment string
|
UsernameFragment string
|
||||||
Password string
|
Password string
|
||||||
@@ -181,9 +181,9 @@ func (e *SettingEngine) SetVNet(vnet *vnet.Net) {
|
|||||||
e.vnet = vnet
|
e.vnet = vnet
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateMulticastDNSCandidates instructs pion/ice to generate host candidates with mDNS hostnames instead of IP Addresses
|
// SetICEMulticastDNSMode controls if pion/ice queries and generates mDNS ICE Candidates
|
||||||
func (e *SettingEngine) GenerateMulticastDNSCandidates(generateMulticastDNSCandidates bool) {
|
func (e *SettingEngine) SetICEMulticastDNSMode(multicastDNSMode ice.MulticastDNSMode) {
|
||||||
e.candidates.GenerateMulticastDNSCandidates = generateMulticastDNSCandidates
|
e.candidates.MulticastDNSMode = multicastDNSMode
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMulticastDNSHostName sets a static HostName to be used by pion/ice instead of generating one on startup
|
// SetMulticastDNSHostName sets a static HostName to be used by pion/ice instead of generating one on startup
|
||||||
|
Reference in New Issue
Block a user