Add InterfaceFilter to SettingEngine

This allows users to filter interfaces from ICE gathering

Resolves #843

Co-authored-by: Sean DuBois <sean@siobud.com>
This commit is contained in:
Aaron France
2019-09-16 01:14:10 +02:00
committed by Sean DuBois
parent d8b7905aaf
commit cabbd8b52f
7 changed files with 34 additions and 16 deletions

View File

@@ -33,6 +33,7 @@ type SettingEngine struct {
ICELite bool
ICETrickle bool
ICENetworkTypes []NetworkType
InterfaceFilter func(string) bool
}
LoggerFactory logging.LoggerFactory
}
@@ -105,3 +106,11 @@ func (e *SettingEngine) SetTrickle(trickle bool) {
func (e *SettingEngine) SetNetworkTypes(candidateTypes []NetworkType) {
e.candidates.ICENetworkTypes = candidateTypes
}
// SetInterfaceFilter sets the filtering functions when gathering ICE candidates
// This can be used to exclude certain network interfaces from ICE. Which may be
// useful if you know a certain interface will never succeed, or if you wish to reduce
// the amount of information you wish to expose to the remote peer
func (e *SettingEngine) SetInterfaceFilter(filter func(string) bool) {
e.candidates.InterfaceFilter = filter
}