Overview
TheSettingEngine allows you to influence WebRTC behavior in ways that are not supported by the standard WebRTC API. This enables advanced use cases like custom network configurations, DTLS tuning, and ICE optimization without deviating from the WebRTC API elsewhere.
The SettingEngine must be configured before creating a PeerConnection. Settings are applied when you create an API object with
webrtc.NewAPI(webrtc.WithSettingEngine(s)).Creating a Custom API
settingengine.go
ICE Configuration
Port Range
Limit the UDP port range for ICE candidate gathering:port-range.go
ICE Timeouts
Configure ICE connection timeouts and keepalive intervals:ice-timeouts.go
Network Types
Control which network types are used for ICE candidates:network-types.go
Interface and IP Filtering
Filter which network interfaces and IP addresses are used:filtering.go
NAT Traversal
NAT 1:1 IPs
Configure external IP addresses for servers behind NAT (e.g., AWS EC2 with Elastic IP):nat-1to1.go
Address Rewrite Rules
Modern alternative to NAT1To1IPs with more control:address-rewrite.go
DTLS Configuration
Retransmission Interval
dtls-retransmit.go
Skip Hello Verify
dtls-skip-verify.go
Elliptic Curves
dtls-curves.go
Connection Context
Control DTLS handshake timeout:dtls-context.go
SCTP Configuration
Buffer Sizes
sctp-buffer.go
Zero Checksum
sctp-checksum.go
Advanced Features
Single Port (UDPMux)
Serve multiple PeerConnections on a single UDP port:udp-mux.go
ICE-TCP
Enable ICE over TCP:ice-tcp.go
ICE Lite
Configure as ICE Lite agent:ice-lite.go
Custom Logging
Provide a custom logger factory:custom-logger.go
Data Channel Detach
Detach data channels for direct I/O access:detach.go
Replay Protection
DTLS/SRTP Replay Protection
replay-protection.go
ICE Credentials
Set static ICE credentials for signalless WebRTC:ice-credentials.go
Complete Example
Full SettingEngine Configuration Example
Full SettingEngine Configuration Example
complete-example.go
Related Resources
MediaEngine
Configure codecs and RTP parameters
Interceptors
Modify RTP/RTCP packet processing
Custom Logging
Implement custom logging
ICE Configuration
Deep dive into ICE settings