common

package
v0.0.0-...-e2bd792 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_CREATED = "created"
	STATUS_RUNNING = "running"
	STATUS_PENDING = "pending"
	STATUS_PAUSED  = "paused"
	STATUS_DONE    = "done"
	STATUS_FAILED  = "failed"
	STATUS_QUIT    = "quit"

	RES_CPU = "cpu"
	RES_GPU = "gpu"
	RES_NET = "net"
)

Variables

This section is empty.

Functions

func CompareTools

func CompareTools(t1, t2 Tool) bool

Compare two Tools to see if they are the same

func Copy

func Copy(dst, src string) error

Copy a file from one place to another

func CopyPrepend

func CopyPrepend(dst, src, prepend string) error

CopyPrepend a file with prepended value

func GenerateResourceKeys

func GenerateResourceKeys(ca *x509.Certificate, caPrivKey *rsa.PrivateKey, cn string) (*x509.Certificate, *rsa.PrivateKey, error)

GenerateResourceKeys generates the client authentication certificate and private key for TLS mutual authentication between the Queue and a Resource.

func GetCertandKey

func GetCertandKey(certPath, keyPath string) (*x509.Certificate, *rsa.PrivateKey, error)

Parse PEM encoded certificate and private key from file path locations

func IsDone

func IsDone(status string) bool

Function to determine if a status shows something is completed

func IsFailed

func IsFailed(status string) bool

Function to determine if a status shows something has failed

func IsNew

func IsNew(status string) bool

Function to determine if a status shows something is newly created

func IsRunning

func IsRunning(status string) bool

Function to determine if a status shwos something is running

func StripQuotes

func StripQuotes(str string) string

func WriteCertificateToFile

func WriteCertificateToFile(cert *x509.Certificate, filepath string) error

WriteCertificateToPEM converts a certificate to PEM and writes to filepath

func WriteCertificateToString

func WriteCertificateToString(cert *x509.Certificate) (string, error)

Converts a certificate to the PEM encoding format and puts it into a string

func WriteRSAPrivateKeyToFile

func WriteRSAPrivateKeyToFile(key *rsa.PrivateKey, filepath string) error

WriteRSAPrivateKeyToPEM converts a RSA Private Key to PEM and writes to filepath

func WriteRSAPrivateKeyToString

func WriteRSAPrivateKeyToString(key *rsa.PrivateKey) (string, error)

Converts a private key to the PEM format and puts it into a string

Types

type JSONSchemaForm

type JSONSchemaForm struct {
	Form   json.RawMessage `json:"form"`
	Schema json.RawMessage `json:"schema"`
}

type Job

type Job struct {
	UUID             string            // UUID generated by the Queue
	ToolUUID         string            // ID of the tool to use with this job
	Name             string            // Name of the job
	Status           string            // Status of the job
	Error            string            // Last returned error from the tool
	StartTime        time.Time         // Start time of the job
	PurgeTime        time.Time         // Time to remove the job from the queue during a Queue.keeper()
	ETC              string            // The estimated time of completion
	Owner            string            // Owner provided by the web frontend
	ResAssigned      string            // Resource this job is assinged to if any
	CrackedHashes    int64             // # of hashes cracked
	TotalHashes      int64             // # of hashes provided
	Progress         float64           // # % of cracked/provided
	Parameters       map[string]string // Parameters returned to the tool
	PerformanceData  map[string]string // Some performance status map[timestamp]perf#
	PerformanceTitle string            // Title of the perf #
	OutputData       [][]string        // A 2D array of rows for output values
	OutputTitles     []string          // The headers for the 2D array of rows above
}

func NewJob

func NewJob(tooluuid string, name string, owner string, params map[string]string) Job

type RPCCall

type RPCCall struct {
	Job Job
}

type Tasker

type Tasker interface {
	Status() Job
	Run() error
	Pause() error
	Quit() Job
	IOE() (io.Writer, io.Reader, io.Reader)
}

type Tool

type Tool struct {
	Name         string
	Type         string
	Version      string
	UUID         string
	Parameters   string
	Requirements string
}

type Tooler

type Tooler interface {
	Name() string
	Type() string
	Version() string
	UUID() string
	SetUUID(string)
	Parameters() string
	Requirements() string
	NewTask(Job) (Tasker, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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