Documentation ¶
Index ¶
- Constants
- Variables
- func CheckJWT(tokenstring string, secret string, alg []string, subject string, ...) error
- func CheckRequestJWT(req *http.Request, secret string, alg []string, subject string, ...) error
- func CreateLogger(module string, logfile string, loglevel string) (log *logging.Logger, lf *os.File)
- func FileExists(filename string) bool
- func NameFromUri(uri url.URL) string
- func NewJWT(secret string, subject string, alg string, valid int64, domain string, ...) (tokenString string, err error)
- func NewServer(...) (*memoServer, error)
- func NewTokenServiceServer(addr string, jwtSecret string, jwtAlg string, jwtValid time.Duration, ...) *tokenServiceServer
- func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string
- func SingleJoiningSlash(a, b string) string
- type Action
- type ActionAudio
- type ActionExternal
- type ActionIIIFManifest
- type ActionImageIIIF
- type ActionMaster
- type ActionVideo
- type Filesystem
- type FilesystemDisk
- type FilesystemPool
- type IdleTimeoutConn
- type MediaAccess
- type MediaEntry
- type MediaProtocol
- type MediaStatus
- type ReadSeekerCloser
- type ResolverCache
- type ResolverDB
- type ResolverDBMySQL
- type ResolverDBStatic
- type Sig
Constants ¶
const ( Media_File MediaProtocol = 0 Media_Redirect MediaProtocol = 1 Media_Proxy MediaProtocol = 2 Media_ProxyDirect MediaProtocol = 3 Media_Public MediaAccess = 0 Media_Private MediaAccess = 1 Media_OK MediaStatus = 0 Media_Error MediaStatus = 1 Media_New = 2 )
Variables ¶
var ( // conversion string to protocol MediaProtocolString = map[string]MediaProtocol{ "file": Media_File, "redirect": Media_Redirect, "proxy": Media_Proxy, "proxydirect": Media_ProxyDirect, } // conversion protocol number to string MediaProtocolNum = map[MediaProtocol]string{ Media_File: "file", Media_Redirect: "redirect", Media_Proxy: "proxy", Media_ProxyDirect: "proxydirect", } // conversion string to access type MediaAccessString = map[string]MediaAccess{ "public": Media_Public, "closed": Media_Private, } // conversion access number to access string MediaAccessNum = map[MediaAccess]string{ Media_Public: "public", Media_Private: "closed", } MediaStatusString = map[string]MediaStatus{ "ok": Media_OK, "error": Media_Error, "new": Media_New, } MediaStatusNum = map[MediaStatus]string{ Media_OK: "ok", Media_Error: "error", Media_New: "new", } )
var (
VERSION string = "Memoriav Mediaserver 0.1"
)
Functions ¶
func CheckRequestJWT ¶
func CreateLogger ¶
func FileExists ¶
func NewServer ¶
func NewServer( baseUrl, urlPrefix, cmdPrefix, iiifPrefix, iiifBase, iiifCached, iiifUrl, iiifJwtSubPrefix, iiifViewerTemplate, iiifManifestBase, iiifRenderingBase, addr string, insecureProxy bool, resolver *ResolverCache, mapping *FilesystemPool, jwtSecret string, jwtAlg []string, log *logging.Logger, accesslog io.Writer, errorTemplate string, viewer map[string]string, staticPrefix, staticDir string) (*memoServer, error)
func NewTokenServiceServer ¶
func SingleJoiningSlash ¶
Types ¶
type Action ¶
type Action interface { // media types which are allowed for this Action GetType() []string // execute the Action Do(w http.ResponseWriter, req *http.Request, m *MediaEntry, action string, params ...string) (bool, error) }
interface for a generic Action on a media object
type ActionAudio ¶
type ActionAudio struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionAudio ¶
func NewActionAudio(ms *memoServer) *ActionAudio
func (*ActionAudio) Do ¶
func (aa *ActionAudio) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionAudio) GetType ¶
func (aa *ActionAudio) GetType() []string
type ActionExternal ¶
type ActionExternal struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionExternal ¶
func NewActionExternal(ms *memoServer) *ActionExternal
func (*ActionExternal) Do ¶
func (ae *ActionExternal) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionExternal) GetType ¶
func (ae *ActionExternal) GetType() []string
type ActionIIIFManifest ¶
type ActionIIIFManifest struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionIIIFManifest ¶
func NewActionIIIFManifest(ms *memoServer) *ActionIIIFManifest
func (*ActionIIIFManifest) Do ¶
func (am *ActionIIIFManifest) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionIIIFManifest) GetType ¶
func (am *ActionIIIFManifest) GetType() []string
type ActionImageIIIF ¶
type ActionImageIIIF struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionImageIIIF ¶
func NewActionImageIIIF(ms *memoServer) *ActionImageIIIF
func (*ActionImageIIIF) Do ¶
func (iai *ActionImageIIIF) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionImageIIIF) GetType ¶
func (iai *ActionImageIIIF) GetType() []string
type ActionMaster ¶
type ActionMaster struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionMaster ¶
func NewActionMaster(ms *memoServer) *ActionMaster
func (*ActionMaster) Do ¶
func (am *ActionMaster) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionMaster) GetType ¶
func (am *ActionMaster) GetType() []string
type ActionVideo ¶
type ActionVideo struct {
// contains filtered or unexported fields
}
image Action using IIIF server for image manipulation
func NewActionVideo ¶
func NewActionVideo(ms *memoServer) *ActionVideo
func (*ActionVideo) Do ¶
func (av *ActionVideo) Do(w http.ResponseWriter, req *http.Request, me *MediaEntry, action string, params ...string) (bool, error)
func (*ActionVideo) GetType ¶
func (av *ActionVideo) GetType() []string
type Filesystem ¶
type Filesystem interface { // creates ReadSeekerCloser, returns last modification time Open(uri url.URL) (ReadSeekerCloser, time.Time, error) // checks existence of uri object Exist(uri url.URL) bool // builds native access path Truename(uri url.URL) string }
abstraction interface for creating ReadSeekerCloser
type FilesystemDisk ¶
type FilesystemDisk struct {
// contains filtered or unexported fields
}
instance of Filesystem for "normal" disk filesystems
func NewFilesystemDisk ¶
func NewFilesystemDisk(mapping map[string]string) *FilesystemDisk
constructor for FilesystemDisk
func (*FilesystemDisk) Exist ¶
func (fm *FilesystemDisk) Exist(uri url.URL) bool
checks existence of file
func (*FilesystemDisk) Open ¶
func (fm *FilesystemDisk) Open(uri url.URL) (ReadSeekerCloser, time.Time, error)
creates ReadSeekerCloser, returns last modification time
type FilesystemPool ¶
type FilesystemPool struct {
// contains filtered or unexported fields
}
pool of filesystems
func (*FilesystemPool) OpenUri ¶
func (fp *FilesystemPool) OpenUri(uri url.URL) (ReadSeekerCloser, time.Time, error)
creates a ReadSeekerCloser for a specified uri from matching Filesystem
func (*FilesystemPool) SetFilesystem ¶
func (fp *FilesystemPool) SetFilesystem(scheme string, fs Filesystem)
set a Filesystem for a specified uri scheme
type IdleTimeoutConn ¶
type IdleTimeoutConn struct {
// contains filtered or unexported fields
}
connection enhancment to make sure, that unused connections will be closed afert timeout
func NewIdleTimeoutConn ¶
func NewIdleTimeoutConn(conn net.Conn, idleTimeout time.Duration) IdleTimeoutConn
type MediaAccess ¶
type MediaAccess int
type MediaEntry ¶
type MediaEntry struct { Signature string URI url.URL Protocol MediaProtocol Access MediaAccess Status MediaStatus Type string Mimetype string Width, Height, Duration int64 ManifestV2, ManifestV3 string }
Represents the data needed to stream media object
func NewMediaEntry ¶
func NewMediaEntry(signature, uri, access, protocol, status, t, mimetype string, width, height, length int64, manifestV2, manifestV3 string) (*MediaEntry, error)
type MediaStatus ¶
type MediaStatus int
type ReadSeekerCloser ¶
type ReadSeekerCloser interface { io.ReadCloser io.Seeker }
io.ReadCloser with io.seeker for http.ServeContent
type ResolverCache ¶
type ResolverCache struct {
// contains filtered or unexported fields
}
the ResolvarCache contains the database resolver and a caching structure
func NewResolver ¶
func NewResolver(r ResolverDB, cacheSize int, cachetimeout time.Duration) *ResolverCache
create a new ResolverCache todo: expiration konfigurierbar
func (*ResolverCache) ClearCache ¶
func (r *ResolverCache) ClearCache()
if data changes, we have to clear the cache to prevent the use of old content
func (*ResolverCache) TestData ¶
func (r *ResolverCache) TestData(mediatype, access string, num int64) ([]*MediaEntry, error)
type ResolverDB ¶
type ResolverDB interface { Resolve(signature string) (*MediaEntry, error) TestData(mediatype, access string, num int64) ([]*MediaEntry, error) Close() }
for a type to be a ResolverDB there must be a function for resolving a signature and a close function for shtutdown
type ResolverDBMySQL ¶
type ResolverDBMySQL struct {
// contains filtered or unexported fields
}
resolver for MySQL database (should work with PostGreSQL too)
func NewResolverDBMysql ¶
func NewResolverDBMysql(db *sql.DB, query string) (*ResolverDBMySQL, error)
create new ResolverDBMySQL
func (*ResolverDBMySQL) Init ¶
func (rdm *ResolverDBMySQL) Init() (err error)
initializes ResolverDBMySQL
func (*ResolverDBMySQL) Resolve ¶
func (rdm *ResolverDBMySQL) Resolve(signature string) (*MediaEntry, error)
resolve MediaEntry for signature
func (*ResolverDBMySQL) TestData ¶
func (rdm *ResolverDBMySQL) TestData(mediatype, access string, num int64) ([]*MediaEntry, error)
type ResolverDBStatic ¶
type ResolverDBStatic struct {
// contains filtered or unexported fields
}
* Static resolver for testing the memoServer functionality
func NewResolverDBStatic ¶
func NewResolverDBStatic(signatures map[string]Sig) *ResolverDBStatic
func (*ResolverDBStatic) Close ¶
func (rds *ResolverDBStatic) Close()
func (*ResolverDBStatic) Resolve ¶
func (rds *ResolverDBStatic) Resolve(signature string) (*MediaEntry, error)
func (*ResolverDBStatic) TestData ¶
func (rds *ResolverDBStatic) TestData(mediatype, access string, num int64) ([]*MediaEntry, error)
Source Files ¶
- action.go
- actionAudio.go
- actionExternal.go
- actionIIIFManifest.go
- actionImageIIIF.go
- actionMaster.go
- actionVideo.go
- clientProxy.go
- filesystem.go
- filesystemDisk.go
- helper.go
- idleTimeoutConn.go
- mediaEntry.go
- memoServer.go
- memoServerHandlerCommand.go
- memoServerHandlerIIIF.go
- memoServerHandlerMain.go
- metricsHandler.go
- requestProxy.go
- resolverCache.go
- resolverDB.go
- resolverDBMySQL.go
- resolverDBStatic.go
- reverseProxy.go
- tokenServiceServer.go
- vars.go