Crate rustream

source ·
Expand description

§RuStream

made-with-rust

crates.io

build none-shall-pass

§Summary

RuStream is a self-hosted streaming engine, that can render videos via authenticated sessions.

§Installation

cargo add RuStream

§Usage

use rustream;

#[actix_rt::main]
async fn main() {
    match rustream::start().await {
        Ok(_) => {
            println!("RuStream session terminated")
        }
        Err(err) => {
            eprintln!("Error starting rustream: {}", err)
        }
    }
}
Download OS specific Executable
§macOS
curl -o RuStream-Darwin-x86_64.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/RuStream/releases/latest/download/RuStream-Darwin-x86_64.tar.gz"
§Linux
curl -o RuStream-Linux-x86_64.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/RuStream/releases/latest/download/RuStream-Linux-x86_64.tar.gz"
§RaspberryPi
curl -o RuStream-RaspberryPi.tar.gz -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/RuStream/releases/latest/download/RuStream-RaspberryPi.tar.gz"
§Windows
curl -o RuStream-Windows-x86_64.zip -LH "Accept: application/octet-stream" "https://github.com/thevickypedia/RuStream/releases/latest/download/RuStream-Windows-x86_64.zip"
§Arguments
  • debug - Enable debug level logging
§Flags
  • --filename / -f - Filename (JSON) for the secrets’ config. Defaults to config.json
  • --version / -v - Get package version
§Config file

RuStream requires a JSON file with secrets loaded as key-value paris.

Mandatory

  • authorization: Dictionary of key-value pairs with username as key and password as value.
  • video_source: Source path for video files.

Files starting with _ (underscore) and . (dot) will be ignored

Optional

  • video_host: IP address to host the video. Defaults to 127.0.0.1 / localhost
  • video_port: Port number to host the application. Defaults to 8000
  • session_duration: Time (in seconds) each authenticated session should last. Defaults to 3600
  • file_formats: Vector of supported video file formats. Defaults to [.mp4, .mov]
  • workers: Number of workers to spin up for the server. Defaults to the number of physical cores.
  • max_connections: Maximum number of concurrent connections per worker. Defaults to 3
  • websites: Vector of websites (supports regex) to add to CORS configuration. Required only if tunneled via CDN
  • key_file: Path to the private key file for SSL certificate. Defaults to None
  • cert_file: Path to the full chain file for SSL certificate. Defaults to None
  • secure_session: Boolean flag to secure the cookie session_token. Defaults to false

If SECURE_SESSION to set to true, the cookie session_token will only be sent via HTTPS
This means that the server can ONLY be hosted via HTTPS or localhost

Sample content of JSON file
{
  "authorization": {"rustic":  "S0m3rAn0mP@ssW0rD"},
  "video_source": "/Users/hannibal/Downloads/stream",
  "video_port": 5883,
  "file_formats": ["mov", "mp4", "mkv"],
  "workers": 10
}

§Crate

https://crates.io/crates/RuStream

§Cargo Docs - Official Runbook

https://docs.rs/RuStream/latest/rustream/

Generator

cargo doc --document-private-items --no-deps

§GitHub Wiki - Project Insights

https://github.com/thevickypedia/RuStream/wiki

§Linting

§Requirement

rustup component add clippy

§Usage

cargo clippy --no-deps --fix

© Vignesh Rao

Licensed under the MIT License

Modules§

  • constant 🔒
    Module to load all the static values and required structs during startup.
  • jinja 🔒
    Module to read the HTML files and load as Jinja templates.
  • routes 🔒
    Module for all the API entry points.
  • squire 🔒
    Module to store all the helper functions.
  • templates 🔒
    Module to load all the templates for the UI.

Functions§

  • Contains entrypoint and initializer settings to trigger the asynchronous HTTPServer