supplier

package
v0.0.0-...-c77f481 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Algorithm

type Algorithm uint8
const (
	MD2 Algorithm = iota
	MD4
	MD5
	GOST
	SHA1
	SHA224
	SHA256
	SHA384
	SHA512
	RMD160
	SHA3_224
	SHA3_256
	SHA3_384
	SHA3_512
	SHA512_224
	SHA512_256
	BLAKE2s256
	BLAKE2b256
	BLAKE2b384
	BLAKE2b512
	SHAKE128
	SHAKE256
	SM3
)

func ValueOf

func ValueOf(val *string) Algorithm

string to Algorithm type TODO returns no error but instead 127

func (Algorithm) Name

func (a Algorithm) Name() string

algo in string

func (Algorithm) Ordinal

func (a Algorithm) Ordinal() uint8

algo enum index

type BaseSupplier

type BaseSupplier struct {
	Algorithm Algorithm

	File         *file.File
	TimeOut      int
	Key          string
	StartTime    time.Time
	IsConcurrent bool
	// contains filtered or unexported fields
}

embedded struct for suppliers

type CommandSupplier

type CommandSupplier struct {
	BaseSupplier
	Type CommandType
}

Common command executor for openssl or OS apps for unix, max i.e. shaXXXsum application will be called for openssl it is openssl see getCommand method for commands

func (*CommandSupplier) Data

func (s *CommandSupplier) Data() *BaseSupplier

func (*CommandSupplier) Delete

func (s *CommandSupplier) Delete()

remove file

func (*CommandSupplier) Run

func (s *CommandSupplier) Run()

start calculation

func (*CommandSupplier) Status

func (s *CommandSupplier) Status() *status.Status

return status

func (*CommandSupplier) Supports

func (s *CommandSupplier) Supports() []Algorithm

check if this runner can run given algo i.e. openssl doesnt have MD2 support

func (*CommandSupplier) Terminate

func (s *CommandSupplier) Terminate() error

terminate process

type CommandType

type CommandType int
const (
	UNIX CommandType = iota
	MAC
	WINDOWS
	OPENSSL
)

type GoSupplier

type GoSupplier struct {
	BaseSupplier
}

Calculates checksum using core go libraries

func (*GoSupplier) Data

func (s *GoSupplier) Data() *BaseSupplier

func (*GoSupplier) Delete

func (s *GoSupplier) Delete()

delete file

func (*GoSupplier) Run

func (s *GoSupplier) Run()

start calculation

func (*GoSupplier) Status

func (s *GoSupplier) Status() *status.Status

return status

func (*GoSupplier) Supports

func (s *GoSupplier) Supports() []Algorithm

return supported algos

func (*GoSupplier) Terminate

func (s *GoSupplier) Terminate() error

terminate

type ISupplierFactory

type ISupplierFactory interface {
	GetSupplierByAlgo(config *Config, algorithm *Algorithm) (Supplier, error)
}

reads the config and returns realted supplier

type Supplier

type Supplier interface {
	Run()
	Status() *status.Status
	Terminate() error
	Supports() []Algorithm
	Delete()
	Data() *BaseSupplier
}

Supplier ares main runner for calculation

type SupplierFactory

type SupplierFactory struct {
}

factory struct

func (*SupplierFactory) GetSupplierByAlgo

func (factory *SupplierFactory) GetSupplierByAlgo(config *Config, algorithm *Algorithm) (Supplier, error)

returns supplier instance for the given algo and lib i.e. for -lib go -a MD5 it will return GoSupplier to calculate MD5

Jump to

Keyboard shortcuts

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