utils

package
v0.0.0-...-715658b Latest Latest
Warning

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

Go to latest
Published: May 8, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(path string) error

func DecodeBase64

func DecodeBase64(payloadString string) ([]byte, error)

Wrapper for DecodeBase64ToBytes

func DecodeBase64ToBytes

func DecodeBase64ToBytes(payloadString string) ([]byte, error)

func DecodeBase64ToString

func DecodeBase64ToString(payloadString string) (string, error)

Convenience function.

func DelaySecond

func DelaySecond(n time.Duration)

func DeleteDirectory

func DeleteDirectory(path string) error

func DeleteFile

func DeleteFile(pathToFile string) error

func EncodeBase64

func EncodeBase64(payloadBytes []byte) string

Wrapper for EncodeBase64FromBytes

func EncodeBase64FromBytes

func EncodeBase64FromBytes(payloadBytes []byte) string

func EncodeBase64FromString

func EncodeBase64FromString(payloadString string) string

Convenience function.

func InitiateDirectory

func InitiateDirectory(directory string)

func IsDirectory

func IsDirectory(path string) (bool, error)

func IsFile

func IsFile(pathToFile string) bool

func PrintError

func PrintError(str string)

func PrintErrorFull

func PrintErrorFull(str string, err error)

func PrintLine

func PrintLine()

func PrintStatus

func PrintStatus(str string)

func PrintSuccess

func PrintSuccess(str string)

func ReadFromFile

func ReadFromFile(pathToFile string) ([]byte, error)

func StoreFileFromDownload

func StoreFileFromDownload(f File, path string) error

func StripFilePathBase

func StripFilePathBase(pathToFile string) string

func WriteToFile

func WriteToFile(data []byte, pathToFile string) error

Types

type Config

type Config struct {
	Author   string `json:"author"`
	Path     string `json:"path"`
	Date     string `json:"date"`
	Mode     string `json:"mode"`
	Hardware string `json:"hardware"`
	Host     string `json:"host"`
	Protocol string `json:"protocol"`
	Version  string `json:"version"`
	Port     string `json:"port"`
	Hotload  bool   `json:"hotload"`
	Verbose  bool   `json:"verbose"`
	Apikey   string `json:"apikey"`
}

type File

type File struct {
	FileNameEnc string `json:"name"` // base64 encoded.
	FileName    string `json:"-"`
	FilePath    string
	ContentEnc  []byte `json:"content"` // not encoded?
	Content     []byte `json:"-"`
	PasswordEnc string `json:"password"`  // base64 encoded.
	Signature   string `json:"signature"` // base64 encoded.
	HMAC        string `json:"HMAC"`      // base64 encoded.
	UserID      string `json:"userID"`    // ? needed here?
	FileSize    int    `json:"fileSize"`
	// Does the server not do anything with empty fields?
	ID     int       `json:"ID"`
	Expiry time.Time `json:"expiry"`
	Sender string    `json:"sender"`
}

type Key

type Key struct {
	Content []byte `json:"content"`
}

type KeyServer

type KeyServer struct {
	ID      int    `json:"ID"`
	Content []byte `json:"content"`
	UserID  string `json:"userID"`
}

Jump to

Keyboard shortcuts

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