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.
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 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
- Variables
- func ClearMime(mimetype string) string
- func CreateLogger(module string, logfile string, loglevel string) (log *logging.Logger, lf *os.File)
- func FileExists(filename string) bool
- func Max(a, b int64) int64
- type Action
- func NewActionExternal(name, address string, capability ActionCapability, ...) Action
- func NewActionFFProbe(ffprobe string, wsl bool, timeout time.Duration, online bool, ...) Action
- func NewActionIdentify(identify, convert string, wsl bool, timeout time.Duration, online bool, ...) Action
- func NewActionNSRL(nsrldb *badger.DB, server *Server) Action
- func NewActionSiegfried(signatureFile string, mimeMap map[string]string, server *Server) Action
- func NewActionTika(uri string, timeout time.Duration, regexpMime string, online bool, ...) Action
- type ActionCapability
- type ActionExternal
- type ActionFFProbe
- type ActionIdentify
- type ActionNSRL
- type ActionNSRLMeta
- type ActionParam
- type ActionSiegfried
- type ActionTika
- type ExternalActionCalltype
- type FFMPEGMime
- type FileMapper
- type MimeWeight
- type MimeWeightString
- type SFTP
- func (s *SFTP) Get(uri url.URL, w io.Writer) (int64, error)
- func (s *SFTP) GetConnection(address, user string) (*SSHConnection, error)
- func (s *SFTP) GetFile(uri url.URL, user string, target string) (int64, error)
- func (s *SFTP) Put(uri url.URL, user string, r io.Reader) (int64, error)
- func (s *SFTP) PutFile(uri url.URL, user string, source string) (int64, error)
- type SSHConnection
- type SSHConnectionPool
- type Server
- func (s *Server) AddAction(a Action)
- func (s *Server) DoPanic(writer http.ResponseWriter, status int, message string) (err error)
- func (s *Server) DoPanicf(writer http.ResponseWriter, status int, message string, a ...interface{}) (err error)
- func (s *Server) HandleDefault(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListenAndServe(addr, cert, key string) error
- func (s *Server) MimeRelevance(mimetype string) (relevance int)
- func (s *Server) Shutdown(ctx context.Context) error
Constants ¶
const ( ACTFILE ActionCapability = 1 << iota // needs local file ACTHTTP // capable of HTTP ACTHTTPS // capable of HTTPS ACTHEAD // can deal with file head ACTWEB = ACTHTTPS | ACTHTTP ACTALLPROTO = ACTFILE | ACTHTTP | ACTHTTPS ACTALL = ACTALLPROTO | ACTHEAD ACTFILEHEAD = ACTFILE | ACTHEAD ACTFILEFULL = ACTFILE & ^ACTHEAD )
const NSRL_File = "SHA-1-"
const NSRL_MFG = "MFgCode-"
const NSRL_OS = "OpSystemCode-"
const NSRL_PROD = "ProductCode-"
Variables ¶
var ACTAction map[string]ActionCapability = map[string]ActionCapability{ "ACTFILE": ACTFILE, "ACTHTTP": ACTHTTP, "ACTHTTPS": ACTHTTPS, "ACTHEAD": ACTHEAD, }
var ACTString map[ActionCapability]string = map[ActionCapability]string{ ACTFILE: "ACTFILE", ACTHTTP: "ACTHTTP", ACTHTTPS: "ACTHTTPS", ACTHEAD: "ACTHEAD", }
var EACTAction map[string]ExternalActionCalltype = map[string]ExternalActionCalltype{ "EACTURL": EACTURL, "EACTJSONPOST": EACTJSONPOST, }
var EACTString map[ExternalActionCalltype]string = map[ExternalActionCalltype]string{ EACTURL: "EACTURL", EACTJSONPOST: "EACTJSONPOST", }
var ErrMimeNotApplicable = errors.New("mime type not applicable for action")
Functions ¶
func CreateLogger ¶
func FileExists ¶
Types ¶
type Action ¶
type Action interface { Do(uri *url.URL, mimetype *string, width *uint, height *uint, duration *time.Duration, checksums map[string]string) (interface{}, error) GetName() string GetCaps() ActionCapability }
func NewActionExternal ¶
func NewActionExternal( name, address string, capability ActionCapability, callType ExternalActionCalltype, mimetype string, server *Server) Action
func NewActionFFProbe ¶
func NewActionIdentify ¶
func NewActionSiegfried ¶
type ActionCapability ¶
type ActionCapability uint
func (*ActionCapability) UnmarshalText ¶
func (a *ActionCapability) UnmarshalText(text []byte) error
for toml decoding
type ActionExternal ¶
type ActionExternal struct {
// contains filtered or unexported fields
}
func (*ActionExternal) GetCaps ¶
func (as *ActionExternal) GetCaps() ActionCapability
func (*ActionExternal) GetName ¶
func (as *ActionExternal) GetName() string
type ActionFFProbe ¶
type ActionFFProbe struct {
// contains filtered or unexported fields
}
func (*ActionFFProbe) GetCaps ¶
func (as *ActionFFProbe) GetCaps() ActionCapability
func (*ActionFFProbe) GetName ¶
func (as *ActionFFProbe) GetName() string
type ActionIdentify ¶
type ActionIdentify struct {
// contains filtered or unexported fields
}
func (*ActionIdentify) GetCaps ¶
func (ai *ActionIdentify) GetCaps() ActionCapability
func (*ActionIdentify) GetName ¶
func (ai *ActionIdentify) GetName() string
type ActionNSRL ¶
type ActionNSRL struct {
// contains filtered or unexported fields
}
func (*ActionNSRL) GetCaps ¶
func (aNSRL *ActionNSRL) GetCaps() ActionCapability
func (*ActionNSRL) GetName ¶
func (aNSRL *ActionNSRL) GetName() string
type ActionNSRLMeta ¶
type ActionParam ¶
type ActionSiegfried ¶
type ActionSiegfried struct {
// contains filtered or unexported fields
}
func (*ActionSiegfried) GetCaps ¶
func (as *ActionSiegfried) GetCaps() ActionCapability
func (*ActionSiegfried) GetName ¶
func (as *ActionSiegfried) GetName() string
type ActionTika ¶
type ActionTika struct {
// contains filtered or unexported fields
}
func (*ActionTika) GetCaps ¶
func (at *ActionTika) GetCaps() ActionCapability
func (*ActionTika) GetName ¶
func (at *ActionTika) GetName() string
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 FileMapper ¶
type FileMapper struct {
// contains filtered or unexported fields
}
func NewFileMapper ¶
func NewFileMapper(mapping map[string]string) *FileMapper
type MimeWeight ¶
type MimeWeight struct {
// contains filtered or unexported fields
}
type MimeWeightString ¶
type SFTP ¶
type SFTP struct {
// contains filtered or unexported fields
}
func (*SFTP) GetConnection ¶
func (s *SFTP) GetConnection(address, user string) (*SSHConnection, error)
type SSHConnection ¶
type SSHConnection struct {
// contains filtered or unexported fields
}
func NewSSHConnection ¶
func NewSSHConnection(address, user string, config *ssh.ClientConfig, log *logging.Logger) (*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)
type SSHConnectionPool ¶
type SSHConnectionPool struct {
// contains filtered or unexported fields
}
func NewSSHConnectionPool ¶
func NewSSHConnectionPool(log *logging.Logger) *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 *logging.Logger, accesslog io.Writer, errorTemplate string, tempDir string, fm *FileMapper, sftp *SFTP, ) (*Server, error)
func (*Server) HandleDefault ¶
func (s *Server) HandleDefault(w http.ResponseWriter, r *http.Request)
func (*Server) ListenAndServe ¶
func (*Server) MimeRelevance ¶
holistic function to give some mimetypes a relevance