listener

package module
v0.0.0-...-e796e2a Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

README

hls-stats

Small package and two example applications (/cmd) for downloading segments in a HLS (.m3u8) playlist.

Logs failing downloads and duration of segment downloads.

load-gen

Perform paralell download of segments in playlist to simulate load from real clients

Usage
load-gen [options] [url]

URL must include protocol and point to a variant-playlist

Options:

  • buffer
    • Number of segments away from live edge to start playback (default 1)
  • instances
    • Number of paralell clients (default 10)
  • proxy
    • HTTP(S) proxy [http://URL:port]
  • quiet
    • Do not print successful downloads
  • useragent
    • Provide custom value for User-Agent header (default "hls-stats-0.02")

hls-stats

Config

Currently you have to run the binary in the same directory as a config.json file with the follwoing structure:

{
  "playlistUrls": [
    "https://example.com/audiom3u8"
  ],
  "bufferSegments": 0,
  "influxEndpoint": "https://example.com",
  "influxOrg": "Example Org",
  "influxBucket": "Example Bucket",
  "influxToken": "{{token }}"
}

Influx parameters are optional

Arguments

  • -influx: Use Influx for remote logging
  • -quiet: Do not print successful downloads

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartListener

func StartListener(playlistUrlString string, bufferSegments int, l Logger, httpClient *http.Client, userAgent string)

Types

type Logger

type Logger interface {
	SuccessfullyDownloaded(message SuccessMessage)
	ErrorWhileDownloading(playbackError PlaybackError)
}

type PlaybackError

type PlaybackError struct {
	CorrelationId uuid.UUID
	Time          time.Time

	URL  string
	Host string
	File string

	HTTPStatusCode int
	Message        string
}

type SuccessMessage

type SuccessMessage struct {
	CorrelationId uuid.UUID
	Time          time.Time

	URL   string
	Host  string
	File  string
	Bytes int

	Duration time.Duration
}

Directories

Path Synopsis
cmd
hls-stats command
load-gen command

Jump to

Keyboard shortcuts

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