Documentation ¶
Index ¶
- Constants
- func AddFullDefaultHeader(w http.ResponseWriter, r *http.Request, newKey string, newVals []string) bool
- func GenerateETag(source string) string
- func GetRoutes(cfg endpoint.Config) (map[string]EndpointRoutes, error)
- func ParseHTTPDate(d string) (time.Time, bool)
- func PrintRoutes(w io.Writer, routes map[string]EndpointRoutes, ...)
- func StartHTTPListener(conf endpoint.Config, routes map[string]EndpointRoutes) error
- func StartHTTPSListener(conf endpoint.Config, routes map[string]EndpointRoutes) error
- type BodyInterceptor
- type EndpointRoutes
Constants ¶
const ContentTypeJSON = `application/json`
const ContentTypeM3U8 = `application/x-mpegURL`
const ContentTypeTS = `video/MP2T`
const LiveM3U8MinDuration = time.Duration(40) * time.Second // TODO make configurable
LiveM3U8MinDuration is used to govern the minimum number of seconds to be present in a live m2u8
const LiveM3U8MinFiles = 20 // TODO make configurable
LiveM3U8MinFiles is used to govern the minimum number of files to be present in a live m3u8
Variables ¶
This section is empty.
Functions ¶
func AddFullDefaultHeader ¶
func GenerateETag ¶
func GetRoutes ¶
func GetRoutes(cfg endpoint.Config) (map[string]EndpointRoutes, error)
GetRoutes returns the map of config IDs, to the full HTTP paths, e.g. for each m3u8 and ts created for that config object.
func ParseHTTPDate ¶
ParseHTTPDate parses the given RFC7231§7.1.1 HTTP-date
func PrintRoutes ¶
func PrintRoutes(w io.Writer, routes map[string]EndpointRoutes, endpointPrefix, routePrefix string, showFragments bool)
PrintRoutes writes the routes across multiple lines in human-readable format to the given writer. The header is written at the beginning of each endpoint. The routePrefix is written at the beginning of each route. If showFragments is false, only manifests and meta files are printed, not video fragments.
func StartHTTPListener ¶
func StartHTTPListener(conf endpoint.Config, routes map[string]EndpointRoutes) error
StartHTTPListener kicks off the HTTPS stack
func StartHTTPSListener ¶
func StartHTTPSListener(conf endpoint.Config, routes map[string]EndpointRoutes) error
StartHTTPSListener kicks off the HTTPS stack
Types ¶
type BodyInterceptor ¶
type BodyInterceptor struct {
// contains filtered or unexported fields
}
BodyInterceptor is a container for a http writer body so we can write headers after the real writes are issued
func (*BodyInterceptor) Body ¶
func (i *BodyInterceptor) Body() []byte
Body is used for interface compatability with http response writer
func (*BodyInterceptor) Header ¶
func (i *BodyInterceptor) Header() http.Header
Header is used for interface compatability with http response writer
func (*BodyInterceptor) RealWrite ¶
func (i *BodyInterceptor) RealWrite() (int, error)
RealWrite is called to perform the actual write operation already done further in the chain
func (*BodyInterceptor) Write ¶
func (i *BodyInterceptor) Write(b []byte) (int, error)
Write is used for interface compatability with http response writer
func (*BodyInterceptor) WriteHeader ¶
func (i *BodyInterceptor) WriteHeader(rc int)
WriteHeader doesn't actually write a header, just a response code. Thanks go.
type EndpointRoutes ¶
type EndpointRoutes struct { MasterPath string VariantPaths []string FragmentPaths []string MetaJSONPaths []string IsABR bool }
EndpointRoutes contains the paths of all HTTP routes for a given config "endpoint" TODO come up with a better structure. The static and abr checks are hackish, the structure should only contain the necessary variables for the given route. Maybe there's a better way with interfaces?