Skip to content

Commit

Permalink
Allow using mDNS candidates with UDP multiplexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksbgbg authored and Sean-Der committed Mar 20, 2024
1 parent 970978e commit a728446
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ func (a *Agent) gatherCandidatesLocalUDPMux(ctx context.Context) error { //nolin
return errInvalidAddress
}
candidateIP := udpAddr.IP
if a.extIPMapper != nil && a.extIPMapper.candidateType == CandidateTypeHost {
if a.mDNSMode != MulticastDNSModeQueryAndGather &&
a.extIPMapper != nil &&
a.extIPMapper.candidateType == CandidateTypeHost {
mappedIP, err := a.extIPMapper.findExternalIP(candidateIP.String())
if err != nil {
a.log.Warnf("1:1 NAT mapping is enabled but no external IP is found for %s", candidateIP.String())
Expand All @@ -276,9 +278,16 @@ func (a *Agent) gatherCandidatesLocalUDPMux(ctx context.Context) error { //nolin
candidateIP = mappedIP
}

var address string
if a.mDNSMode == MulticastDNSModeQueryAndGather {
address = a.mDNSName
} else {
address = candidateIP.String()
}

hostConfig := CandidateHostConfig{
Network: udp,
Address: candidateIP.String(),
Address: address,
Port: udpAddr.Port,
Component: ComponentRTP,
}
Expand Down

0 comments on commit a728446

Please sign in to comment.