Skip to content

Commit

Permalink
Add NAT_ICE_CANDIDATE_TYPE
Browse files Browse the repository at this point in the history
Allow user to override SetNAT1To1IPs Candidate Type
  • Loading branch information
Sean-Der committed Jul 8, 2024
1 parent b8abf62 commit 0752132
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,18 @@ docker-compose up -d
The backend can be configured with the following environment variables.

- `DISABLE_STATUS` - Disable the status API
- `ENABLE_HTTP_REDIRECT` - HTTP traffic will be redirect to HTTPS
- `DISABLE_FRONTEND` - Disable the serving of frontend. Only REST APIs + WebRTC is enabled.
- `HTTP_ADDRESS` - HTTP Server Address
- `INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP` - Like `NAT_1_TO_1_IP` but autoconfigured
- `INTERFACE_FILTER` - Only use a certain interface for UDP traffic
- `NAT_1_TO_1_IP` - If behind a NAT use this to auto insert your public IP
- `NETWORK_TEST_ON_START` - When "true" on startup Broadcast Box will check network connectivity

- `ENABLE_HTTP_REDIRECT` - HTTP traffic will be redirect to HTTPS
- `SSL_CERT` - Path to SSL certificate if using Broadcast Box's HTTP Server
- `SSL_KEY` - Path to SSL key if using Broadcast Box's HTTP Server

- `NAT_1_TO_1_IP` - Announce IPs that don't belong to local machine (like Public IP). delineated by ','
- `INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP` - Like `NAT_1_TO_1_IP` but autoconfigured
- `INTERFACE_FILTER` - Only use a certain interface for UDP traffic
- `NAT_ICE_CANDIDATE_TYPE` - By default setting a NAT_1_TO_1_IP overrides. Set this to `srflx` to instead append IPs
- `STUN_SERVERS` - List of STUN servers delineated by '|'. Useful if Broadcast Box is running behind a NAT

- `UDP_MUX_PORT_WHEP` - Like `UDP_MUX_PORT` but only for WHEP traffic
Expand Down
9 changes: 7 additions & 2 deletions internal/webrtc/webrtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,16 @@ func createSettingEngine(isWHIP bool, udpMuxCache map[int]*ice.MultiUDPMuxDefaul
}

if os.Getenv("NAT_1_TO_1_IP") != "" {
NAT1To1IPs = append(NAT1To1IPs, os.Getenv("NAT_1_TO_1_IP"))
NAT1To1IPs = append(NAT1To1IPs, strings.Split(os.Getenv("NAT_1_TO_1_IP"), ",")...)
}

natICECandidateType := webrtc.ICECandidateTypeHost
if os.Getenv("NAT_ICE_CANDIDATE_TYPE") == "srflx" {
natICECandidateType = webrtc.ICECandidateTypeSrflx
}

if len(NAT1To1IPs) != 0 {
settingEngine.SetNAT1To1IPs(NAT1To1IPs, webrtc.ICECandidateTypeHost)
settingEngine.SetNAT1To1IPs(NAT1To1IPs, natICECandidateType)
}

if os.Getenv("INTERFACE_FILTER") != "" {
Expand Down

0 comments on commit 0752132

Please sign in to comment.