m3uproxy

command module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 4 Imported by: 0

README

m3uproxy

m3uproxy is a Go-based HTTP server designed to proxy HLS (HTTP Live Streaming) streams. It provides a convenient way to manage and distribute streaming streams with user management and access control features.

Features

  • M3U Playlist Generation: Serve dynamically generated M3U playlists for your streams.
  • XMLTV EPG Support: Provide an XMLTV formatted Electronic Program Guide (EPG) for supported streams.
  • HLS Stream Proxying: Securely proxy HLS streams via a token-based system.
  • User Management: Control access to the M3U playlist and streaming streams.
  • Fallback Message: Serve a "stream unavailable" message when necessary.

Endpoints

/streams.m3u (Restricted)
  • Description: Returns the M3U playlist with all available streams.
  • Access: Restricted to authenticated users.
  • Usage: This endpoint should be accessed only after proper authentication. It provides a list of streams in the M3U format.
/epg.xml
  • Description: Returns the Electronic Program Guide (EPG) in XMLTV format.
  • Access: Public.
  • Usage: Useful for clients that support EPGs to fetch the program guide associated with the streams.
/m3uproxy/proxy/{token}/{streamId}/*
  • Description: Proxies the HLS stream for the specified stream.
  • Access: Token-based access control.
  • Parameters:
    • token: A unique token to authenticate the request.
    • streamId: The identifier of the stream.
  • Usage: Used by clients to access the actual HLS stream. Replace {token} and {streamId} with valid values.
/m3uproxy/streams/*
  • Description: Streams a "stream unavailable" message. (FFMPEG > 5.0 must be installed)
  • Access: Internal use only.
  • Usage: Automatically redirected when a stream is unavailable or an error occurs.

Installation

To install m3uproxy, you need to have Go installed on your machine.

  1. Clone the repository:

    git clone https://github.com/a13labs/m3uproxy.git
    cd m3uproxy
    
  2. Build the project:

    go build -o m3uproxy
    
  3. Run the server:

    ./m3uproxy server start -m <m3u file> -e <epg file> -u <users file> -p <port>
    

User Management

m3uproxy includes basic user management features. Users can be added, removed, or modified through a command-line interface or API.

Adding a User

To add a user, run:

./m3uproxy users add -u <users file> <username> <password>
Removing a User

To remove a user, run:

./m3uproxy users remove -u <users file> <username>
Modifying a User

To modify a user's password, run:

./m3uproxy users password -u <users file> <username> <newpassword>

Usage

Once the server is up and running, you can access the required endpoints as follows:

  • M3U Playlist: [Your Server URL]:[port]/streams.m3u
  • EPG XML: [Your Server URL]:[port]/epg.xml

Ensure that appropriate access controls are configured to restrict access to sensitive endpoints.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue to discuss any changes or improvements.

License

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

Acknowledgments

  • Thanks to the Go community for providing the tools and resources to build this project.
  • Special mention to the developers of libraries and tools used in this project.

Documentation

Overview

Copyright © 2024 Alexandre Pires

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to

Keyboard shortcuts

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