add interface filter config (#502)
* add interface filter config * Update config-sample.yaml Co-authored-by: David Zhao <david@davidzhao.com> * better description Co-authored-by: David Zhao <david@davidzhao.com>
This commit is contained in:
co-authored by
David Zhao
parent
cd2a7c2447
commit
e4c321de02
+27
-1
@@ -64,7 +64,7 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
|
||||
LoggerFactory: logging.NewLoggerFactory(logger.GetLogger()),
|
||||
}
|
||||
|
||||
if externalIP != "" {
|
||||
if conf.RTC.UseExternalIP && externalIP != "" {
|
||||
s.SetNAT1To1IPs([]string{externalIP}, webrtc.ICECandidateTypeHost)
|
||||
}
|
||||
|
||||
@@ -180,6 +180,32 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
|
||||
s.SetLite(true)
|
||||
}
|
||||
|
||||
if len(rtcConf.Interfaces.Includes) != 0 || len(rtcConf.Interfaces.Excludes) != 0 {
|
||||
includes := rtcConf.Interfaces.Includes
|
||||
excludes := rtcConf.Interfaces.Excludes
|
||||
s.SetInterfaceFilter(func(s string) bool {
|
||||
//filter by include interfaces
|
||||
if len(includes) > 0 {
|
||||
for _, iface := range includes {
|
||||
if iface == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// filter by exclude interfaces
|
||||
if len(excludes) > 0 {
|
||||
for _, iface := range excludes {
|
||||
if iface == s {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
return &WebRTCConfig{
|
||||
Configuration: c,
|
||||
SettingEngine: s,
|
||||
|
||||
Reference in New Issue
Block a user