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 NewJWT(secret string, subject string, alg string, valid int64, domain string, ...) (tokenString string, err error)
- func NewServer(...) *memoServer
- func NewTokenServiceServer(addr string, jwtSecret string, jwtAlg string, jwtValid time.Duration, ...) *tokenServiceServer
- func SingleJoiningSlash(a, b string) string
- type FileMapper
- type IdleTimeoutConn
- type MediaAccess
- type MediaEntry
- type MediaProtocol
- type MediaStatus
- type ResolverCache
- type ResolverDB
- type ResolverDBMySQL
- type ResolverDBStatic
- type Sig
Constants ¶
View Source
const ( Media_File MediaProtocol = 0 Media_Redirect MediaProtocol = 1 Media_Proxy MediaProtocol = 2 Media_Public MediaAccess = 0 Media_Private MediaAccess = 1 Media_OK MediaStatus = 0 Media_Error MediaStatus = 1 Media_New = 2 )
Variables ¶
View Source
var ( // conversion string to protocol MediaProtocolString = map[string]MediaProtocol{ "file": Media_File, "redirect": Media_Redirect, "proxy": Media_Proxy, } // conversion protocol number to string MediaProtocolNum = map[MediaProtocol]string{ Media_File: "file", Media_Redirect: "redirect", Media_Proxy: "proxy", } // 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", } )
View Source
var (
VERSION string = "Memoriav Mediaserver 0.1"
)
Functions ¶
func CheckRequestJWT ¶
func CreateLogger ¶
func FileExists ¶
func NewServer ¶
func NewServer( urlPrefix, cmdPrefix, iiifPrefix, iiifBase, iiifUrl, iiifJwtSubPrefix, iiifViewerTemplate, addr string, resolver *ResolverCache, mapping *FileMapper, jwtSecret string, jwtAlg []string, log *logging.Logger, accesslog io.Writer, errorTemplate, videoViewerTemplate, audioViewerTemplate, staticPrefix, staticDir string) *memoServer
func NewTokenServiceServer ¶
func SingleJoiningSlash ¶
Types ¶
type FileMapper ¶
type FileMapper struct {
// contains filtered or unexported fields
}
func NewFileMapper ¶
func NewFileMapper(mapping map[string]string) *FileMapper
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 }
Represents the data needed to stream media object
func NewMediaEntry ¶
func NewMediaEntry(signature, uri, access, protocol, status string) (*MediaEntry, error)
type MediaStatus ¶
type MediaStatus int
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) *ResolverCache
create a new ResolverCache
func (*ResolverCache) ClearCache ¶
func (r *ResolverCache) ClearCache()
if data changes, we have to clear the cache to prevent the use of old content
type ResolverDB ¶
type ResolverDB interface { Resolve(signature string) (*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
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)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.