Skip to content

[ICE] Add general ICE host candidate mapping #3189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions icegatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
DisableActiveTCP: g.api.settingEngine.iceDisableActiveTCP,
MaxBindingRequests: g.api.settingEngine.iceMaxBindingRequests,
BindingRequestHandler: g.api.settingEngine.iceBindingRequestHandler,
HostUDPAdvertisedAddrsMapper: g.api.settingEngine.candidates.HostUDPAdvertisedAddrsMapper,

Check failure on line 135 in icegatherer.go

View workflow job for this annotation

GitHub Actions / lint / Go

unknown field HostUDPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig

Check failure on line 135 in icegatherer.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

unknown field HostUDPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig

Check failure on line 135 in icegatherer.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

unknown field HostUDPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig
HostTCPAdvertisedAddrsMapper: g.api.settingEngine.candidates.HostTCPAdvertisedAddrsMapper,

Check failure on line 136 in icegatherer.go

View workflow job for this annotation

GitHub Actions / lint / Go

unknown field HostTCPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig) (typecheck)

Check failure on line 136 in icegatherer.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

unknown field HostTCPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig

Check failure on line 136 in icegatherer.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

unknown field HostTCPAdvertisedAddrsMapper in struct literal of type ice.AgentConfig
}

requestedNetworkTypes := g.api.settingEngine.candidates.ICENetworkTypes
Expand Down
34 changes: 23 additions & 11 deletions settingengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@
ICESTUNGatherTimeout *time.Duration
}
candidates struct {
ICELite bool
ICENetworkTypes []NetworkType
InterfaceFilter func(string) (keep bool)
IPFilter func(net.IP) (keep bool)
NAT1To1IPs []string
NAT1To1IPCandidateType ICECandidateType
MulticastDNSMode ice.MulticastDNSMode
MulticastDNSHostName string
UsernameFragment string
Password string
IncludeLoopbackCandidate bool
ICELite bool
ICENetworkTypes []NetworkType
InterfaceFilter func(string) (keep bool)
IPFilter func(net.IP) (keep bool)
NAT1To1IPs []string
NAT1To1IPCandidateType ICECandidateType
MulticastDNSMode ice.MulticastDNSMode
MulticastDNSHostName string
UsernameFragment string
Password string
IncludeLoopbackCandidate bool
HostUDPAdvertisedAddrsMapper func(net.IP) []ice.Endpoint

Check failure on line 60 in settingengine.go

View workflow job for this annotation

GitHub Actions / lint / Go

undefined: ice.Endpoint

Check failure on line 60 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 60 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 60 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint

Check failure on line 60 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint
HostTCPAdvertisedAddrsMapper func(net.IP) []ice.Endpoint

Check failure on line 61 in settingengine.go

View workflow job for this annotation

GitHub Actions / lint / Go

undefined: ice.Endpoint

Check failure on line 61 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 61 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 61 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint

Check failure on line 61 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint
}
replayProtection struct {
DTLS *uint
Expand Down Expand Up @@ -267,6 +269,16 @@
e.candidates.NAT1To1IPCandidateType = candidateType
}

// SetHostUDPAdvertisedAddrsMapper sets the function that maps the local UDP address to the advertised UDP addresses.
func (e *SettingEngine) SetHostUDPAdvertisedAddrsMapper(mapper func(net.IP) []ice.Endpoint) {

Check failure on line 273 in settingengine.go

View workflow job for this annotation

GitHub Actions / lint / Go

undefined: ice.Endpoint

Check failure on line 273 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 273 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 273 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint

Check failure on line 273 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint
e.candidates.HostUDPAdvertisedAddrsMapper = mapper
}

// SetHostTCPAdvertisedAddrsMapper sets the function that maps the local TCP address to the advertised TCP addresses.
func (e *SettingEngine) SetHostTCPAdvertisedAddrsMapper(mapper func(net.IP) []ice.Endpoint) {

Check failure on line 278 in settingengine.go

View workflow job for this annotation

GitHub Actions / lint / Go

undefined: ice.Endpoint

Check failure on line 278 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 278 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.23) / Go 1.23

undefined: ice.Endpoint

Check failure on line 278 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint

Check failure on line 278 in settingengine.go

View workflow job for this annotation

GitHub Actions / test (1.24) / Go 1.24

undefined: ice.Endpoint
e.candidates.HostTCPAdvertisedAddrsMapper = mapper
}

// SetIncludeLoopbackCandidate enable pion to gather loopback candidates, it is useful
// for some VM have public IP mapped to loopback interface.
func (e *SettingEngine) SetIncludeLoopbackCandidate(include bool) {
Expand Down
Loading