Documentation ¶
Index ¶
- Variables
- func ArchiveAndCompressFiles(files []*os.File) (*os.File, int64, error)
- func ByteCountSI(b int64) string
- func Contains(s []string, str string) bool
- func DecodePayload(payload interface{}, target interface{}) (err error)
- func DecompressAndUnarchiveBytes(reader io.Reader) ([]string, int64, error)
- func DisplayWidth(s string) int
- func FilesTotalSize(files []*os.File) (int64, error)
- func GeneratePassword(id int) models.Password
- func GetOpenPort() (int, error)
- func HashPassword(password models.Password) string
- func Indent(s, indent string) string
- func IsUserCancellation(err error) bool
- func MutuallyExclusive(message string, conditions ...bool) error
- func ParsePassword(passStr string) (models.Password, error)
- func PrintError(out io.Writer, err error, cmd *cobra.Command, debug bool)
- func RandomSeed()
- func ReadEncryptedMessage(wsConn *websocket.Conn, crypt *crypt.Crypt) (protocol.TransferMessage, error)
- func ReadFiles(fileNames []string) ([]*os.File, error)
- func ReadTranxMessage(wsConn *websocket.Conn, expected protocol.TranxMessageType) (protocol.TranxMessage, error)
- func RemoveTemporaryFiles(prefix string)
- func ReplaceExcessiveWhitespace(s string) string
- func Truncate(maxWidth int, s string) string
- func TruncateColumn(maxWidth int, s string) string
- func ValidateHostname(name string) error
- func WebsocketHandler(wsHandler WsHandlerFunc) http.HandlerFunc
- func WriteEncryptedMessage(wsConn *websocket.Conn, msg protocol.TransferMessage, crypt *crypt.Crypt) error
- type FlagError
- type WsHandlerFunc
Constants ¶
This section is empty.
Variables ¶
var CancelError = errors.New("CancelError")
CancelError signals user-initiated cancellation
var SilentError = errors.New("SilentError")
SilentError is an error that triggers exit code 1 without any error messaging
Functions ¶
func ArchiveAndCompressFiles ¶
ArchiveAndCompressFiles tars and gzip-compresses files into a temporary file, returning it along with the resulting size
func ByteCountSI ¶
source: https://yourbasic.org/golang/formatting-byte-size-to-human-readable-format
func DecodePayload ¶
func DecodePayload(payload interface{}, target interface{}) (err error)
func DecompressAndUnarchiveBytes ¶
DecompressAndUnarchiveBytes gzip-decompresses and un-tars files into the current working directory and returns the names and decompressed size of the created files
func DisplayWidth ¶
DisplayWidth calculates what the rendered width of a string may be
func FilesTotalSize ¶
Traverses files and directories (recursively) for total size in bytes
func GeneratePassword ¶
GeneratePassword generates a random password prefixed with the supplied id.
func GetOpenPort ¶
func HashPassword ¶
func IsUserCancellation ¶
func MutuallyExclusive ¶
func RandomSeed ¶
func RandomSeed()
func ReadEncryptedMessage ¶
func ReadTranxMessage ¶
func ReadTranxMessage(wsConn *websocket.Conn, expected protocol.TranxMessageType) (protocol.TranxMessage, error)
func RemoveTemporaryFiles ¶
func RemoveTemporaryFiles(prefix string)
func TruncateColumn ¶
TruncateColumn replaces the first new line character with an ellipsis and shortens a string to fit the maximum display width
func ValidateHostname ¶
ValidateHostname returns an error if the domain name is not valid source: https://gist.github.com/chmike/d4126a3247a6d9a70922fc0e8b4f4013
func WebsocketHandler ¶
func WebsocketHandler(wsHandler WsHandlerFunc) http.HandlerFunc
func WriteEncryptedMessage ¶
Types ¶
type FlagError ¶
type FlagError struct {
Err error
}
FlagError is the kind of error raised in flag processing