feat: add WithSettingEngineFunc ConnectOption to customize the SettingEngine#935
Open
UbiShipDev1 wants to merge 1 commit into
Open
feat: add WithSettingEngineFunc ConnectOption to customize the SettingEngine#935UbiShipDev1 wants to merge 1 commit into
UbiShipDev1 wants to merge 1 commit into
Conversation
…gEngine The SDK builds its webrtc.SettingEngine internally in NewPCTransport with no extension point, so callers cannot influence ICE behavior beyond the existing WithICETransportPolicy / WithDisableTURN options. When a client is co-located with the SFU on a host that has many network interfaces (docker bridges, veth, IPv6), pion gathers ICE host candidates from all of them and can select an unreachable one, silently breaking the media path. The fix is SettingEngine.SetInterfaceFilter / SetIPFilter, which the SDK does not currently expose. WithSettingEngineFunc passes the SettingEngine to a caller-supplied func after the SDK finishes configuring it and before the API is built, for both the publisher and subscriber PeerConnections. It is opt-in and changes nothing when unset. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Contributor
|
@UbiShipDev1 could you please sign our Contributor License Agreement? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
NewPCTransportbuilds itswebrtc.SettingEngineinternally with no extension point, so callers cannot influence ICE behavior beyondWithICETransportPolicy/WithDisableTURN.We run a server-side agent co-located with the SFU on a host that has many interfaces (docker bridges,
veth*, IPv6). pion gathers ICE host candidates from all of them and sometimes selects an unreachable one, silently breaking the subscriber media path (the agent goes "deaf"). The remedy isSettingEngine.SetInterfaceFilter/SetIPFilter, which the SDK doesn't expose.Change
Adds a single, opt-in
ConnectOption:fnruns after the SDK finishes configuring theSettingEngineand beforewebrtc.NewAPI, so callers can layer ICE interface/IP filters,SetNAT1To1IPs, etc. without losing the SDK's own settings.Usage:
Details
signalling.ConnectParams.SettingEngineFunccarries the hook;WithSettingEngineFuncsets it (mirrors the existing option pattern).NewPCTransportcalls (publisher + subscriber) and invoked inNewPCTransportjust beforewebrtc.NewAPI.TestWithSettingEngineFunc).go build ./... && go testgreen.Happy to adjust naming or scope to fit your conventions.
🤖 Generated with Claude Code