Skip to content

Commit 345d574

Browse files
WofWcaSean-Der
authored andcommitted
Update SettingEngine to use named return values
The behavior of SetInterfaceFilter and SetIPFilter isn't obvious. Name the bool so the user understands the behavior from the function definition.
1 parent 7c76e09 commit 345d574

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

settingengine.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ type SettingEngine struct {
4848
candidates struct {
4949
ICELite bool
5050
ICENetworkTypes []NetworkType
51-
InterfaceFilter func(string) bool
52-
IPFilter func(net.IP) bool
51+
InterfaceFilter func(string) (keep bool)
52+
IPFilter func(net.IP) (keep bool)
5353
NAT1To1IPs []string
5454
NAT1To1IPCandidateType ICECandidateType
5555
MulticastDNSMode ice.MulticastDNSMode
@@ -201,15 +201,15 @@ func (e *SettingEngine) SetNetworkTypes(candidateTypes []NetworkType) {
201201
// This can be used to exclude certain network interfaces from ICE. Which may be
202202
// useful if you know a certain interface will never succeed, or if you wish to reduce
203203
// the amount of information you wish to expose to the remote peer
204-
func (e *SettingEngine) SetInterfaceFilter(filter func(string) bool) {
204+
func (e *SettingEngine) SetInterfaceFilter(filter func(string) (keep bool)) {
205205
e.candidates.InterfaceFilter = filter
206206
}
207207

208208
// SetIPFilter sets the filtering functions when gathering ICE candidates
209209
// This can be used to exclude certain ip from ICE. Which may be
210210
// useful if you know a certain ip will never succeed, or if you wish to reduce
211211
// the amount of information you wish to expose to the remote peer
212-
func (e *SettingEngine) SetIPFilter(filter func(net.IP) bool) {
212+
func (e *SettingEngine) SetIPFilter(filter func(net.IP) (keep bool)) {
213213
e.candidates.IPFilter = filter
214214
}
215215

0 commit comments

Comments
 (0)