upload

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	// Auth checks whether the user has access to the passed relative path
	// Note: doesn't check whether the path is actually relative
	Auth(user string, pass string, path string) (string, bool)
}

func NewStaticAuth

func NewStaticAuth(configPath string) (Auth, error)

type AuthConfig

type AuthConfig struct {
	Global GlobalConfig
	Auth   []AuthConfigEntry
}

type AuthConfigEntry

type AuthConfigEntry struct {
	Match string `toml:"match"`
	User  string `toml:"user"`
	Pass  string `toml:"pass"`
}

type CleanupFunc

type CleanupFunc func(slug string, path string)

type GlobalConfig

type GlobalConfig struct {
	AllowedDirs []string `toml:"allowedDirs"`
}

type Parser

type Parser struct{}

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(ctx context.Context, addr string, sinks []*Sink) *Proxy

func (*Proxy) Errors

func (p *Proxy) Errors() <-chan error

The channel returned by Errors is pushed fatal errors

func (*Proxy) HandleUpload

func (p *Proxy) HandleUpload(w http.ResponseWriter, r *http.Request)

do delete ourselves as delete doesnt work...

func (*Proxy) Wait

func (p *Proxy) Wait()

Wait for server to finish

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry tracks the lifetime of uploaded streams and stream segments

func NewRegistry

func NewRegistry(ctx context.Context, callback CleanupFunc) *Registry

func (*Registry) AddFile

func (r *Registry) AddFile(slug string, path string) error

Addfile adds a path to track for a certain stream if the stream doesn't exist yet we assume a timeout, the manifest will have to be uploaded shortly after

func (*Registry) Keepalive

func (r *Registry) Keepalive(slug string, timeout time.Duration)

Keepalive extends the lifetime of a stream and its directories

func (*Registry) Wait

func (r *Registry) Wait()

Wait for registry to stop

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, addr string, path string, auth Auth) *Server

func (*Server) Errors

func (s *Server) Errors() <-chan error

The channel returned by Errors is pushed fatal errors

func (*Server) HandleHealth

func (s *Server) HandleHealth(w http.ResponseWriter, r *http.Request)

func (*Server) HandlePlaylist

func (s *Server) HandlePlaylist(body io.Reader, output io.Writer, path string, slug string) error

func (*Server) HandleSegment

func (s *Server) HandleSegment(body io.Reader, output io.Writer, path string, slug string) error

func (*Server) HandleUpload

func (s *Server) HandleUpload(w http.ResponseWriter, r *http.Request)

do delete ourselves as delete doesnt work...

func (*Server) Wait

func (s *Server) Wait()

Wait for server to finish

type Sink

type Sink struct {
	Address  string
	URL      url.URL
	Username string
	Password string
	// contains filtered or unexported fields
}

type StaticAuth

type StaticAuth struct {
	// contains filtered or unexported fields
}

func (*StaticAuth) Auth

func (a *StaticAuth) Auth(user string, pass string, path string) (string, bool)

Jump to

Keyboard shortcuts

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