Fixes UDPxy stream URL rewriting so multicast streams are detected by parsing the stream URL instead of only matching the udp://@ prefix.
Previously, Threadfin only rewrote URLs beginning with udp://@. That missed valid multicast RTP URLs such as rtp://239.3.1.54:4120, causing /stream/... to redirect clients back to the original multicast URL even when Settings > UDPxy address was configured.
What changed
Rewrites multicast streams for both udp and rtp schemes.
Parses the stream host and only rewrites when it is an IP multicast address.
Leaves hostnames, unicast IPs, and non-UDP/RTP streams unchanged.
Supports IPv4 multicast and bracketed IPv6 multicast addresses.
Allows UDPxy address to be either host:port, http://host:port, or https://host:port.
Keeps the legacy host:port behavior by defaulting it to http://host:port.
Updates the settings text to document the accepted UDPxy address forms.
Adds unit tests for UDP/RTP, IPv4/IPv6 multicast, unicast, hostnames, and HTTP/HTTPS UDPxy base URLs.
msd_lite compatibility
This also makes Threadfin work with msd_lite in UDPxy-compatible mode. msd_lite supports UDPxy-style /udp/ and /rtp/ request paths and adds IPv6 multicast support. With this change, Threadfin can generate compatible URLs such as:
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
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.
Summary
Fixes UDPxy stream URL rewriting so multicast streams are detected by parsing the stream URL instead of only matching the udp://@ prefix.
Previously, Threadfin only rewrote URLs beginning with udp://@. That missed valid multicast RTP URLs such as rtp://239.3.1.54:4120, causing /stream/... to redirect clients back to the original multicast URL even when Settings > UDPxy address was configured.
What changed
msd_lite compatibility
This also makes Threadfin work with msd_lite in UDPxy-compatible mode. msd_lite supports UDPxy-style /udp/ and /rtp/ request paths and adds IPv6 multicast support. With this change, Threadfin can generate compatible URLs such as:
If the configured UDPxy/msd_lite endpoint uses HTTPS, Threadfin now preserves that scheme:
Verification
env GOCACHE=/private/tmp/threadfin-go-build GOMODCACHE=/private/tmp/threadfin-go-mod go test -mod=readonly ./...