hls-proxy

command module
v0.0.0-...-8c9abf5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 13 Imported by: 0

README

Go hls-proxy 📺

MIT License Language PRs Welcome build

✏️Purpose

A simple proxy server that parses m3u8 manifets and proxies all requests. This is useful for adding headers, prefetching clips or other custom logic when loading streams that cannot be modified directly at the source.

🏎 Getting Started

Dependencies

👨‍💻Installing

git clone https://github.com/bitknox/hls-proxy.git
cd hls-proxy
go install
hls-proxy

📝 Usage (JS)

To use the proxy, simply supply the proxy with the url in base64 as shown below. Optionally a referer and origin can be added.

//proxy stream
const proxyHost = "http://localhost"
const proxyPort = "1323"
const streamUrl = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"

const url = `${proxyHost}:${proxyPort}/${btoa(streamUrl)}`

//proxy stream with header
const referer = "https://google.com"
const origin = "https://amazon.com"
//note that origin can be omitted
const input = `${streamUrl}|${referer}|${origin}`
const proxiedUrl = `${proxyHost}:${proxyPort}/${btoa(input)}`

🆘 Help

hls-proxy h
Overview of options
--prefetch                  prefetch ts files (default: true)
--segments value            how many segments to prefetch (default: 30)
--throttle value            how much to throttle prefetch requests (requests per second) (default: 5)
--janitor-interval value    how often should the janitor clean the cache (default: 20s)
--attempts value            how many times to retry a request for a ts file (default: 3)
--clip-retention value      how long to keep ts files in cache (default: 30m0s)
--playlist-retention value  how long to keep playlists in cache (default: 5h0m0s)
--host value                hostname to attach to proxy url
--port value                port to attach to proxy url (default: 1323)
--log-level value           log level (default: "PRODUCTION")
--help, -h                  show help

🧑‍🏭Contributing

Contributions are always welcome. This is one of my first projets in golang, so I'm sure there room for a lot of improvement.

📗 Authors

@bitknox

🗎 Version History

©️ License

This project is licensed under the MIT License - see the LICENSE file for details

🤚 Acknowledgments

Inspiration:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL