indexer

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 48 Imported by: 9

Documentation

Overview

Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package indexer Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package indexer Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package indexer Copyright 2020 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Juergen Enge, info-age GmbH, Basel. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ACTFILE   ActionCapability = 1 << iota // needs local file
	ACTHTTP                                // capable of HTTP
	ACTHTTPS                               // capable of HTTPS
	ACTHEAD                                // can deal with file head
	ACTSTREAM                              // can deal with stream

	ACTWEB      = ACTHTTPS | ACTHTTP
	ACTALLPROTO = ACTFILE | ACTHTTP | ACTHTTPS
	ACTALL      = ACTALLPROTO | ACTHEAD
	ACTFILEHEAD = ACTFILE | ACTHEAD
	ACTFILEFULL = ACTFILE & ^ACTHEAD
)
View Source
const NSRL_File = "SHA-1-"
View Source
const NSRL_MFG = "MFgCode-"
View Source
const NSRL_OS = "OpSystemCode-"
View Source
const NSRL_PROD = "ProductCode-"

Variables

View Source
var ACTAction map[string]ActionCapability = map[string]ActionCapability{
	"ACTFILE":   ACTFILE,
	"ACTHTTP":   ACTHTTP,
	"ACTHTTPS":  ACTHTTPS,
	"ACTHEAD":   ACTHEAD,
	"ACTSTREAM": ACTSTREAM,
}
View Source
var ACTString map[ActionCapability]string = map[ActionCapability]string{
	ACTFILE:   "ACTFILE",
	ACTHTTP:   "ACTHTTP",
	ACTHTTPS:  "ACTHTTPS",
	ACTHEAD:   "ACTHEAD",
	ACTSTREAM: "ACTSTREAM",
}
View Source
var EACTAction map[string]ExternalActionCalltype = map[string]ExternalActionCalltype{
	"EACTURL":      EACTURL,
	"EACTJSONPOST": EACTJSONPOST,
}
View Source
var EACTString map[ExternalActionCalltype]string = map[ExternalActionCalltype]string{
	EACTURL:      "EACTURL",
	EACTJSONPOST: "EACTJSONPOST",
}
View Source
var ErrMimeNotApplicable = errors.New("mime type not applicable for actions")

Functions

func ClearMime

func ClearMime(mimetype string) string

func CreateLogger

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

func FileExists

func FileExists(filename string) bool

func Max

func Max(a, b int64) int64

Types

type Action

type Action interface {
	Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)
	DoV2(filename string) (*ResultV2, error)
	CanHandle(contentType string, filename string) bool
	Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)
	GetName() string
	GetCaps() ActionCapability
	GetWeight() uint
}

func NewActionChecksum

func NewActionChecksum(name string, digests []checksum.DigestAlgorithm, server *Server, ad *ActionDispatcher) Action

func NewActionClamAV

func NewActionClamAV(clamav string, wsl bool, timeout time.Duration, server *Server, ad *ActionDispatcher) Action

func NewActionExternal

func NewActionExternal(name, address string, capability ActionCapability, callType ExternalActionCalltype, mimetype string, server *Server, ad *ActionDispatcher) Action

func NewActionFFProbe

func NewActionFFProbe(name string, ffprobe string, wsl bool, timeout time.Duration, online bool, mime []FFMPEGMime, server *Server, ad *ActionDispatcher) Action

func NewActionIdentify

func NewActionIdentify(name, identify, convert string, wsl bool, timeout time.Duration, online bool, server *Server, ad *ActionDispatcher) Action

func NewActionIdentifyV2

func NewActionIdentifyV2(name, identify, convert string, wsl bool, timeout time.Duration, online bool, server *Server, ad *ActionDispatcher) Action

func NewActionNSRL

func NewActionNSRL(name string, nsrldb *badger.DB, server *Server, ad *ActionDispatcher) Action

func NewActionSiegfried

func NewActionSiegfried(name string, signatureData []byte, mimeMap map[string]string, server *Server, ad *ActionDispatcher) Action

func NewActionTika

func NewActionTika(name, uri string, timeout time.Duration, regexpMime, regexpMimeNot, field string, online bool, server *Server, ad *ActionDispatcher) Action

func NewActionXML added in v2.0.9

func NewActionXML(name string, format map[string]ConfigXMLFormat, server *Server, ad *ActionDispatcher) Action

type ActionCapability

type ActionCapability uint

func (*ActionCapability) UnmarshalText

func (a *ActionCapability) UnmarshalText(text []byte) error

for toml decoding

type ActionChecksum

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

func (*ActionChecksum) CanHandle

func (as *ActionChecksum) CanHandle(contentType string, filename string) bool

func (*ActionChecksum) Do

func (as *ActionChecksum) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionChecksum) DoV2

func (as *ActionChecksum) DoV2(filename string) (*ResultV2, error)

func (*ActionChecksum) GetCaps

func (as *ActionChecksum) GetCaps() ActionCapability

func (*ActionChecksum) GetName

func (as *ActionChecksum) GetName() string

func (*ActionChecksum) GetWeight

func (as *ActionChecksum) GetWeight() uint

func (*ActionChecksum) Stream

func (as *ActionChecksum) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionClamAV

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

func (*ActionClamAV) CanHandle

func (ac *ActionClamAV) CanHandle(contentType string, filename string) bool

func (*ActionClamAV) Do

func (ac *ActionClamAV) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionClamAV) DoV2

func (ac *ActionClamAV) DoV2(filename string) (*ResultV2, error)

func (*ActionClamAV) GetCaps

func (ac *ActionClamAV) GetCaps() ActionCapability

func (*ActionClamAV) GetName

func (ac *ActionClamAV) GetName() string

func (*ActionClamAV) GetWeight

func (ac *ActionClamAV) GetWeight() uint

func (*ActionClamAV) Stream

func (ac *ActionClamAV) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionDispatcher

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

func InitActionDispatcher

func InitActionDispatcher(fss map[string]fs.FS, conf IndexerConfig, logger zLogger.ZWrapper) (*ActionDispatcher, error)

func NewActionDispatcher

func NewActionDispatcher(mimeRelevance map[int]MimeWeightString) *ActionDispatcher

func (*ActionDispatcher) DoV2

func (ad *ActionDispatcher) DoV2(filename string, stateFiles []string, actions []string) (*ResultV2, error)

func (*ActionDispatcher) GetAction

func (ad *ActionDispatcher) GetAction(name string) (Action, bool)

func (*ActionDispatcher) GetActionNames

func (ad *ActionDispatcher) GetActionNames() []string

func (*ActionDispatcher) GetActionNamesByCaps

func (ad *ActionDispatcher) GetActionNamesByCaps(caps ActionCapability) []string

func (*ActionDispatcher) GetActions

func (ad *ActionDispatcher) GetActions() map[string]Action

func (*ActionDispatcher) RegisterAction

func (ad *ActionDispatcher) RegisterAction(action Action)

func (*ActionDispatcher) Sort

func (ad *ActionDispatcher) Sort(actions []string)

func (*ActionDispatcher) Stream

func (ad *ActionDispatcher) Stream(sourceReader io.Reader, stateFiles []string, actions []string) (*ResultV2, error)

type ActionExternal

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

func (*ActionExternal) CanHandle

func (as *ActionExternal) CanHandle(contentType string, filename string) bool

func (*ActionExternal) Do

func (as *ActionExternal) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionExternal) DoV2

func (as *ActionExternal) DoV2(filename string) (*ResultV2, error)

func (*ActionExternal) GetCaps

func (as *ActionExternal) GetCaps() ActionCapability

func (*ActionExternal) GetName

func (as *ActionExternal) GetName() string

func (*ActionExternal) GetWeight

func (as *ActionExternal) GetWeight() uint

func (*ActionExternal) Stream

func (as *ActionExternal) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionFFProbe

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

func (*ActionFFProbe) CanHandle

func (as *ActionFFProbe) CanHandle(contentType string, filename string) bool

func (*ActionFFProbe) Do

func (as *ActionFFProbe) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionFFProbe) DoV2

func (as *ActionFFProbe) DoV2(filename string) (*ResultV2, error)

func (*ActionFFProbe) GetCaps

func (as *ActionFFProbe) GetCaps() ActionCapability

func (*ActionFFProbe) GetName

func (as *ActionFFProbe) GetName() string

func (*ActionFFProbe) GetWeight

func (as *ActionFFProbe) GetWeight() uint

func (*ActionFFProbe) Stream

func (as *ActionFFProbe) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionIdentify

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

func (*ActionIdentify) CanHandle

func (ai *ActionIdentify) CanHandle(contentType string, filename string) bool

func (*ActionIdentify) Do

func (ai *ActionIdentify) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionIdentify) DoV2

func (ai *ActionIdentify) DoV2(filename string) (*ResultV2, error)

func (*ActionIdentify) GetCaps

func (ai *ActionIdentify) GetCaps() ActionCapability

func (*ActionIdentify) GetName

func (ai *ActionIdentify) GetName() string

func (*ActionIdentify) GetWeight

func (ai *ActionIdentify) GetWeight() uint

func (*ActionIdentify) Stream

func (ai *ActionIdentify) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionIdentifyV2

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

func (*ActionIdentifyV2) CanHandle

func (ai *ActionIdentifyV2) CanHandle(contentType string, filename string) bool

func (*ActionIdentifyV2) Do

func (ai *ActionIdentifyV2) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionIdentifyV2) DoV2

func (ai *ActionIdentifyV2) DoV2(filename string) (*ResultV2, error)

func (*ActionIdentifyV2) GetCaps

func (ai *ActionIdentifyV2) GetCaps() ActionCapability

func (*ActionIdentifyV2) GetName

func (ai *ActionIdentifyV2) GetName() string

func (*ActionIdentifyV2) GetWeight

func (ai *ActionIdentifyV2) GetWeight() uint

func (*ActionIdentifyV2) Stream

func (ai *ActionIdentifyV2) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionNSRL

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

func (*ActionNSRL) CanHandle

func (aNSRL *ActionNSRL) CanHandle(contentType string, filename string) bool

func (*ActionNSRL) Do

func (aNSRL *ActionNSRL) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionNSRL) DoV2

func (aNSRL *ActionNSRL) DoV2(filename string) (*ResultV2, error)

func (*ActionNSRL) GetCaps

func (aNSRL *ActionNSRL) GetCaps() ActionCapability

func (*ActionNSRL) GetName

func (aNSRL *ActionNSRL) GetName() string

func (*ActionNSRL) GetWeight

func (aNSRL *ActionNSRL) GetWeight() uint

func (*ActionNSRL) Stream

func (aNSRL *ActionNSRL) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionNSRLMeta

type ActionNSRLMeta struct {
	File    map[string]string
	FileMfG map[string]string
	OS      map[string]string
	OSMfg   map[string]string
	Prod    map[string]string
	ProdMfg map[string]string
}

type ActionParam

type ActionParam struct {
	Url           string            `json:"url"`
	Actions       []string          `json:"actions,omitempty"`
	ForceDownload string            `json:"forcedownload,omitempty"`
	HeaderSize    int64             `json:"headersize,omitempty"`
	Checksums     map[string]string `json:"checksums,omitempty"`
}

type ActionSiegfried

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

func (*ActionSiegfried) CanHandle

func (as *ActionSiegfried) CanHandle(contentType string, filename string) bool

func (*ActionSiegfried) Do

func (as *ActionSiegfried) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionSiegfried) DoV2

func (as *ActionSiegfried) DoV2(filename string) (*ResultV2, error)

func (*ActionSiegfried) GetCaps

func (as *ActionSiegfried) GetCaps() ActionCapability

func (*ActionSiegfried) GetName

func (as *ActionSiegfried) GetName() string

func (*ActionSiegfried) GetWeight

func (as *ActionSiegfried) GetWeight() uint

func (*ActionSiegfried) Stream

func (as *ActionSiegfried) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionTika

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

func (*ActionTika) CanHandle

func (at *ActionTika) CanHandle(contentType string, filename string) bool

func (*ActionTika) Do

func (at *ActionTika) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionTika) DoV2

func (at *ActionTika) DoV2(filename string) (*ResultV2, error)

func (*ActionTika) GetCaps

func (at *ActionTika) GetCaps() ActionCapability

func (*ActionTika) GetName

func (at *ActionTika) GetName() string

func (*ActionTika) GetWeight

func (at *ActionTika) GetWeight() uint

func (*ActionTika) Stream

func (at *ActionTika) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type ActionXML added in v2.0.9

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

func (*ActionXML) CanHandle added in v2.0.9

func (as *ActionXML) CanHandle(contentType string, filename string) bool

func (*ActionXML) Do added in v2.0.9

func (as *ActionXML) Do(uri *url.URL, contentType string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, []string, []string, error)

func (*ActionXML) DoV2 added in v2.0.9

func (as *ActionXML) DoV2(filename string) (*ResultV2, error)

func (*ActionXML) GetCaps added in v2.0.9

func (as *ActionXML) GetCaps() ActionCapability

func (*ActionXML) GetName added in v2.0.9

func (as *ActionXML) GetName() string

func (*ActionXML) GetWeight added in v2.0.9

func (as *ActionXML) GetWeight() uint

func (*ActionXML) Stream added in v2.0.9

func (as *ActionXML) Stream(contentType string, reader io.Reader, filename string) (*ResultV2, error)

type Chromaticity

type Chromaticity struct {
	X float64 `json:"x,omitempty"`
	Y float64 `json:"y,omitempty"`
}

type ConfigChecksum

type ConfigChecksum struct {
	Name    string
	Digest  []checksum.DigestAlgorithm
	Enabled bool
}

type ConfigClamAV

type ConfigClamAV struct {
	Enabled  bool
	Timeout  duration
	ClamScan string
	Wsl      bool
}

type ConfigExternalAction

type ConfigExternalAction struct {
	Name,
	Address,
	Mimetype string
	ActionCapabilities []ActionCapability
	CallType           ExternalActionCalltype
}

type ConfigFFMPEG

type ConfigFFMPEG struct {
	FFProbe string
	Wsl     bool
	Timeout duration
	Online  bool
	Enabled bool
	Mime    []FFMPEGMime
}

type ConfigFileMap

type ConfigFileMap struct {
	Alias  string
	Folder string
}

type ConfigImageMagick

type ConfigImageMagick struct {
	Identify string
	Convert  string
	Wsl      bool
	Timeout  duration
	Online   bool
	Enabled  bool
}

type ConfigMimeWeight

type ConfigMimeWeight struct {
	Regexp string
	Weight int
}

type ConfigNSRL

type ConfigNSRL struct {
	Enabled bool
	Badger  string
}

type ConfigSFTP

type ConfigSFTP struct {
	Knownhosts string
	Password   string
	PrivateKey []string
}

type ConfigSiegfried

type ConfigSiegfried struct {
	//Address string
	Enabled       bool
	SignatureFile string `toml:"signature"`
	MimeMap       map[string]string
}

type ConfigTika

type ConfigTika struct {
	AddressMeta           string
	AddressFulltext       string
	Timeout               duration
	RegexpMimeFulltext    string
	RegexpMimeFulltextNot string
	RegexpMimeMeta        string
	RegexpMimeMetaNot     string
	Online                bool
	Enabled               bool
}

type ConfigXML added in v2.0.9

type ConfigXML struct {
	Enabled bool
	Format  map[string]ConfigXMLFormat
}

type ConfigXMLFormat added in v2.0.9

type ConfigXMLFormat struct {
	Regexp     bool
	Attributes map[string]string
	Pronom     string
	Mime       string
	Type       string
	Subtype    string
}

type DataType

type DataType string
const (
	Byte   DataType = "byte"
	Long   DataType = "long"
	Short  DataType = "short"
	String DataType = "string"
)

type Endian

type Endian string
const (
	LSB Endian = "LSB"
	MSB Endian = "MSB"
)

type ExternalActionCalltype

type ExternalActionCalltype uint
const (
	EACTURL      ExternalActionCalltype = 1 << iota // url with placehoder for full path
	EACTJSONPOST                                    // send json struct via post
)

func (*ExternalActionCalltype) UnmarshalText

func (a *ExternalActionCalltype) UnmarshalText(text []byte) error

for toml decoding

type FFMPEGMime

type FFMPEGMime struct {
	Video  bool
	Audio  bool
	Format string
	Mime   string
}

type FileMapper

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

func NewFileMapper

func NewFileMapper(mapping map[string]string) *FileMapper

func (*FileMapper) Get

func (fm *FileMapper) Get(uri *url.URL) (string, error)

type FullMagickResult

type FullMagickResult struct {
	Magick *MagickResult `json:"magick"`
	Frames []*Geometry   `json:"frames,omitempty"`
}

type Geometry

type Geometry struct {
	Width  float64 `json:"width,omitempty"`
	Height float64 `json:"height,omitempty"`
	X      float64 `json:"x,omitempty"`
	Y      float64 `json:"y,omitempty"`
}

type IndexerConfig

type IndexerConfig struct {
	Enabled         bool
	LocalCache      bool
	TempDir         string
	HeaderTimeout   duration
	HeaderSize      int64
	DownloadMime    string `toml:"forcedownload"`
	MaxDownloadSize int64
	Siegfried       ConfigSiegfried
	Checksum        ConfigChecksum
	FFMPEG          ConfigFFMPEG
	ImageMagick     ConfigImageMagick
	Tika            ConfigTika
	XML             ConfigXML
	External        []ConfigExternalAction
	FileMap         []ConfigFileMap
	URLRegexp       []string
	NSRL            ConfigNSRL
	Clamav          ConfigClamAV
	MimeRelevance   map[string]ConfigMimeWeight
}

func GetDefaultConfig

func GetDefaultConfig() *IndexerConfig

type MIME

type MIME struct {
	Type        string    `json:"_type" xml:"type,attr"`
	Acronym     *string   `json:"_acronym,omitempty" xml:"acronym,attr,omitempty"`
	Description *string   `json:"_description,omitempty" xml:"description,attr,omitempty"`
	Priority    *string   `json:"_priority,omitempty" xml:"priority,attr,omitempty"`
	Pattern     *string   `json:"_pattern,omitempty" xml:"pattern,attr,omitempty"`
	DataType    *DataType `json:"_data-type,omitempty" xml:"data-type,attr,omitempty"`
	Offset      *string   `json:"_offset,omitempty" xml:"offset,attr,omitempty"`
	Magic       *string   `json:"_magic,omitempty" xml:"magic,attr,omitempty"`
	Endian      *Endian   `json:"_endian,omitempty" xml:"endian,attr,omitempty"`
	Mask        *string   `json:"_mask,omitempty" xml:"mask,attr,omitempty"`
}

func GetMagickMime

func GetMagickMime() ([]MIME, error)

type MagickImage

type MagickImage struct {
	Name              string                   `json:"name,omitempty"`
	BaseName          string                   `json:"baseName,omitempty"`
	Permissions       int                      `json:"permissions,omitempty"`
	Format            string                   `json:"format,omitempty"`
	FormatDescription string                   `json:"formatDescription,omitempty"`
	MimeType          string                   `json:"mimeType,omitempty"`
	Class             string                   `json:"class,omitempty"`
	Geometry          *Geometry                `json:"geometry,omitempty"`
	Resolution        *Size                    `json:"resolution,omitempty"`
	PrintSize         *Size                    `json:"printSize,omitempty"`
	Units             string                   `json:"units,omitempty"`
	Type              string                   `json:"type,omitempty"`
	BaseType          string                   `json:"baseType,omitempty"`
	Endianness        string                   `json:"endianness,omitempty"`
	Colorspace        string                   `json:"colorspace,omitempty"`
	Depth             int                      `json:"depth,omitempty"`
	BaseDepth         int                      `json:"baseDepth,omitempty"`
	ChannelDepth      map[string]int           `json:"channelDepth,omitempty"`
	Pixels            int                      `json:"pixels,omitempty"`
	ImageStatistics   map[string]*Statistics   `json:"imageStatistics,omitempty"`
	ChannelStatistics map[string]*Statistics   `json:"channelStatistics,omitempty"`
	RenderingIntent   string                   `json:"renderingIntent,omitempty"`
	Gamma             float64                  `json:"gamma,omitempty"`
	Chromaticity      map[string]*Chromaticity `json:"chromaticity,omitempty"`
	MatteColor        string                   `json:"matteColor,omitempty"`
	BackgroundColor   string                   `json:"backgroundColor,omitempty"`
	BorderColor       string                   `json:"borderColor,omitempty"`
	TransparentColor  string                   `json:"transparentColor,omitempty"`
	Interlace         string                   `json:"interlace,omitempty"`
	Intensity         string                   `json:"intensity,omitempty"`
	Compose           string                   `json:"compose,omitempty"`
	PageGeometry      *Geometry                `json:"pageGeometry,omitempty"`
	Dispose           string                   `json:"dispose,omitempty"`
	Iterations        int                      `json:"iterations,omitempty"`
	Compression       string                   `json:"compression,omitempty"`
	Quality           float64                  `json:"quality,omitempty"`
	Orientation       string                   `json:"orientation,omitempty"`
	Properties        map[string]any           `json:"properties,omitempty"`
	Profiles          map[string]any           `json:"profiles,omitempty"`
	Tainted           bool                     `json:"tainted,omitempty"`
	Filesize          string                   `json:"filesize,omitempty"`
	NumberPixels      string                   `json:"numberPixels,omitempty"`
	PixelsPerSecond   string                   `json:"pixelsPerSecond,omitempty"`
	UserTime          string                   `json:"userTime,omitempty"`
	ElapsedTime       string                   `json:"elapsedTime,omitempty"`
	Version           string                   `json:"version,omitempty"`
}

type MagickResult

type MagickResult struct {
	Version string       `json:"version"`
	Image   *MagickImage `json:"image"`
}

type MimeBase

type MimeBase struct {
	Mimemap Mimemap `json:"mimemap" xml:"mimemap"`
}

type MimeWeight

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

type MimeWeightString

type MimeWeightString struct {
	Regexp string
	Weight int
}

type Mimemap

type Mimemap struct {
	MIME []MIME `json:"mime" xml:"mime"`
}

type ResultV2

type ResultV2 struct {
	Errors    map[string]string `json:"errors,omitempty"`
	Mimetype  string            `json:"mimetype"`
	Mimetypes []string          `json:"mimetypes"`
	Pronom    string            `json:"pronom"`
	Pronoms   []string          `json:"pronoms"`
	Checksum  map[string]string `json:"checksum,omitempty"`
	Width     uint              `json:"width,omitempty"`
	Height    uint              `json:"height,omitempty"`
	Duration  uint              `json:"duration,omitempty"`
	Size      uint64            `json:"size"`
	Metadata  map[string]any    `json:"metadata"`
	Type      string            `json:"type"`
	Subtype   string            `json:"subtype"`
}

func NewResultV2

func NewResultV2() *ResultV2

func (*ResultV2) Merge

func (v *ResultV2) Merge(r *ResultV2)

type SFTP

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

func NewSFTP

func NewSFTP(PrivateKey []string, Password, KnownHosts string, log zLogger.ZWrapper) (*SFTP, error)

func (*SFTP) Get

func (s *SFTP) Get(uri url.URL, w io.Writer) (int64, error)

func (*SFTP) GetConnection

func (s *SFTP) GetConnection(address, user string) (*SSHConnection, error)

func (*SFTP) GetFile

func (s *SFTP) GetFile(uri url.URL, user string, target string) (int64, error)

func (*SFTP) Put

func (s *SFTP) Put(uri url.URL, user string, r io.Reader) (int64, error)

func (*SFTP) PutFile

func (s *SFTP) PutFile(uri url.URL, user string, source string) (int64, error)

type SSHConnection

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

func NewSSHConnection

func NewSSHConnection(address, user string, config *ssh.ClientConfig, log zLogger.ZWrapper) (*SSHConnection, error)

func (*SSHConnection) Close

func (sc *SSHConnection) Close()

func (*SSHConnection) Connect

func (sc *SSHConnection) Connect() error

func (*SSHConnection) GetSFTPClient

func (sc *SSHConnection) GetSFTPClient() (*sftp.Client, error)

func (*SSHConnection) ReadFile

func (sc *SSHConnection) ReadFile(path string, w io.Writer) (int64, error)

func (*SSHConnection) WriteFile

func (sc *SSHConnection) WriteFile(path string, r io.Reader) (int64, error)

type SSHConnectionPool

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

func NewSSHConnectionPool

func NewSSHConnectionPool(log zLogger.ZWrapper) *SSHConnectionPool

func (*SSHConnectionPool) GetConnection

func (cp *SSHConnectionPool) GetConnection(address, user string, config *ssh.ClientConfig) (*SSHConnection, error)

type Server

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

func NewServer

func NewServer(
	headerTimeout time.Duration,
	headerSize int64,
	downloadMime string,
	maxDownloadSize int64,
	mimeRelevance map[int]MimeWeightString,
	jwtSecret string,
	jwtAlg []string,
	insecureCert bool,
	log zLogger.ZWrapper,
	accesslog io.Writer,
	errorTemplate *template.Template,
	tempDir string,
	fm *FileMapper,
	sftp *SFTP,
) (*Server, error)

func (*Server) AddActions

func (s *Server) AddActions(as ...Action)

func (*Server) DoPanic

func (s *Server) DoPanic(writer http.ResponseWriter, status int, message string) (err error)

func (*Server) DoPanicf

func (s *Server) DoPanicf(writer http.ResponseWriter, status int, message string, a ...interface{}) (err error)

func (*Server) HandleDefault

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

func (*Server) HandleVersion

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

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr, cert, key string) error

func (*Server) MimeRelevance

func (s *Server) MimeRelevance(mimetype string) (relevance int)

holistic function to give some mimetypes a relevance

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type Size

type Size struct {
	X float64 `json:"x,omitempty"`
	Y float64 `json:"y,omitempty"`
}

type Statistics

type Statistics struct {
	Min               float64 `json:"min,omitempty"`
	Max               float64 `json:"max,omitempty"`
	Mean              float64 `json:"mean,omitempty"`
	Median            float64 `json:"median,omitempty"`
	StandardDeviation float64 `json:"standardDeviation,omitempty"`
	Kurtosis          float64 `json:"kurtosis,omitempty"`
	Skewness          float64 `json:"skewness,omitempty"`
	Entropy           float64 `json:"entropy,omitempty"`
}

Jump to

Keyboard shortcuts

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