mediaserver

package
v2.0.0-...-3d53c3d Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDomain = "TRAEFIK DEFAULT CERT"

DefaultDomain Traefik domain for the default certificate.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(module string, logfile string, loglevel string) (log *logging.Logger, lf *os.File)

func DefaultCertificate

func DefaultCertificate() (*tls.Certificate, error)

DefaultCertificate generates random TLS certificates.

func KeyPair

func KeyPair(domain string, expiration time.Time) ([]byte, []byte, error)

KeyPair generates cert and key files.

func ListenAndServeHTTP3

func ListenAndServeHTTP3(addr string, certs []tls.Certificate, handler http.Handler) error

func MimeRelevance

func MimeRelevance(mimetype string) (relevance int)

holistic function to give some mimetypes a relevance

func PemCert

func PemCert(privKey *rsa.PrivateKey, domain string, expiration time.Time) ([]byte, error)

PemCert generates PEM cert file.

func UniqueId

func UniqueId() string

Types

type FFProbe

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

func NewFFProbe

func NewFFProbe(mh *MediaHandler, command string) (*FFProbe, error)

func (*FFProbe) GetMetadata

func (fp *FFProbe) GetMetadata(filename string, timeout time.Duration) (width, height, duration int64, mimetype, sub string, metadata interface{}, err error)

func (*FFProbe) SetMediaHandler

func (fp *FFProbe) SetMediaHandler(mh *MediaHandler)

type ImagickIdentify

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

func NewImagickIdentify

func NewImagickIdentify(mh *MediaHandler, identify, convert string) (*ImagickIdentify, error)

func (*ImagickIdentify) GetMetadata

func (ii *ImagickIdentify) GetMetadata(filename string, timeout time.Duration) (width, height, duration int64, mimetype, sub string, metadata interface{}, err error)

func (*ImagickIdentify) SetMediaHandler

func (ii *ImagickIdentify) SetMediaHandler(mh *MediaHandler)

type Indexer

type Indexer struct {
	Siegfried *Siegfried
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer(mh *MediaHandler, siegfriedurl, ffprobe, identify, convert string, identTimeout time.Duration) (*Indexer, error)

func (*Indexer) GetImageMetadata

func (idx *Indexer) GetImageMetadata(filename string) (width, height, duration int64, mimetype, sub string, metadata map[string]interface{}, err error)

func (*Indexer) GetMetadata

func (idx *Indexer) GetMetadata(filename string, _type, subtype, mimetype string) (width, height, duration int64, _mimetype, sub string, metadata map[string]interface{}, err error)

func (*Indexer) GetType

func (idx *Indexer) GetType(filename string) (_type, subtype, mimetype string, metadata map[string]interface{}, err error)

func (*Indexer) GetVideoMetadata

func (idx *Indexer) GetVideoMetadata(filename string) (width, height, duration int64, mimetype, sub string, metadata map[string]interface{}, err error)

func (*Indexer) SetMediaHandler

func (idx *Indexer) SetMediaHandler(mh *MediaHandler)

type MediaHandler

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

func NewMediaHandler

func NewMediaHandler(
	prefix string,
	mdb *database.MediaDatabase,
	idx *Indexer,
	pbx ParamBuilder,
	tempdir string,
	log *logging.Logger,
	fss []filesystem.FileSystem,
	actions []media.Action) (*MediaHandler, error)

func (*MediaHandler) DoPanic

func (s *MediaHandler) DoPanic(writer http.ResponseWriter, status int, message string, jsonresult bool)

func (*MediaHandler) DoPanicf

func (mh *MediaHandler) DoPanicf(writer http.ResponseWriter, status int, message string, jsonresult bool, a ...interface{})

func (*MediaHandler) FileOpenRead

func (*MediaHandler) FileWrite

func (mh *MediaHandler) FileWrite(path string, reader io.Reader, size int64, opts filesystem.FilePutOptions) error

func (*MediaHandler) GetCache

func (mh *MediaHandler) GetCache(collection, signature, action, paramstr string) (*database.Cache, error)

func (*MediaHandler) GetFS

func (*MediaHandler) ServeContent

func (mh *MediaHandler) ServeContent(w http.ResponseWriter, r *http.Request, path string)

func (*MediaHandler) ServeHTTP

func (mh *MediaHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)

func (*MediaHandler) SetRoutes

func (mh *MediaHandler) SetRoutes(router *mux.Router) error

type ParamBuilder

type ParamBuilder map[string][]string

func (ParamBuilder) Clear

func (pb ParamBuilder) Clear(action string, params []string) (map[string]string, error)

type SF

type SF struct {
	Siegfried   string         `json:"siegfried,omitempty"`
	Scandate    string         `json:"scandate,omitempty"`
	Signature   string         `json:"signature,omitempty"`
	Created     string         `json:"created,omitempty"`
	Identifiers []SFIdentifier `json:"identfiers,omitempty"`
	Files       []SFFiles      `json:"files,omitempty"`
}

type SFFiles

type SFFiles struct {
	Filename string      `json:"filename,omitempty"`
	Filesize int64       `json:"filesize,omitempty"`
	Modified string      `json:"modified,omitempty"`
	Errors   string      `json:"errors,omitempty"`
	Matches  []SFMatches `json:"matches,omitempty"`
}

type SFIdentifier

type SFIdentifier struct {
	Name    string `json:"name,omitempty"`
	Details string `json:"details,omitempty"`
}

type SFMatches

type SFMatches struct {
	Ns      string `json:"ns,omitempty"`
	Id      string `json:"id,omitempty"`
	Format  string `json:"format,omitempty"`
	Version string `json:"version,omitempty"`
	Mime    string `json:"mime,omitempty"`
	Basis   string `json:"basis,omitempty"`
	Warning string `json:"warning,omitempty"`
}

type ServerHTTP3

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

func NewServerHTTP3

func NewServerHTTP3(
	addr string,
	httpAddrExt string,
	dataPrefix string,
	mediaPrefix string,
	staticPrefix string,
	staticFolder string,
	jwtKey string,
	jwtAlg []string,
	linkTokenExp time.Duration,
	log *logging.Logger,
	accesslog io.Writer) (*ServerHTTP3, error)

func (*ServerHTTP3) ListenAndServeHTTP3

func (s *ServerHTTP3) ListenAndServeHTTP3(cert, key string, mh *MediaHandler) error

func (*ServerHTTP3) Shutdown

func (s *ServerHTTP3) Shutdown(ctx context.Context)

type SideStream

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

func NewSideStream

func NewSideStream(tempfolder string, size int) (*SideStream, error)

func (*SideStream) Clear

func (ss *SideStream) Clear()

func (*SideStream) Close

func (ss *SideStream) Close()

func (*SideStream) GetBytes

func (ss *SideStream) GetBytes() []byte

func (*SideStream) GetSHA256

func (ss *SideStream) GetSHA256() string

func (*SideStream) Open

func (ss *SideStream) Open() (string, error)

func (*SideStream) Write

func (ss *SideStream) Write(p []byte) (n int, err error)

type Siegfried

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

func NewSiegfried

func NewSiegfried(mh *MediaHandler, urlstring string) (*Siegfried, error)

func (*Siegfried) Identify

func (sf *Siegfried) Identify(filename string) (*SF, error)

func (*Siegfried) SetMediaHandler

func (sf *Siegfried) SetMediaHandler(mh *MediaHandler)

Jump to

Keyboard shortcuts

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