strengthen

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FilesystemSuperMagicTmpfs = 0x01021994
	FilesystemSuperMagicExt4  = 0xEF53
	FilesystemSuperMagicXfs   = 0x58465342
	FilesystemSuperMagicNfs   = 0x6969
	FilesystemSuperMagicZfs   = 0x2fc12fc1
	// FilesystemSuperMagicBtrfs is the 64bit magic for Btrfs
	// we not support 32bit system
	FilesystemSuperMagicBtrfs     = 0x9123683E
	FilesystemSuperMagicCGroup    = 0x27e0eb
	FilesystemSuperMagicCGroup2   = 0x63677270
	FilesystemSuperMagicNTFS      = 0x5346544e
	FilesystemSuperMagicEXFAT     = 0x2011BAB0
	FilesystemSuperMagicCEPH      = 0x00c36400
	FilesystemSuperMagicOverlayFS = 0x794c7630
	// https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf
	FilesystemSuperMagicAPFS = 0x42535041 // BSPA
)
View Source
const (
	Byte int64 = 1 << (iota * 10)
	KiByte
	MiByte
	GiByte
	TiByte
	PiByte
	EiByte
)
View Source
const (
	SystemBlockSize int64 = 512
)

Variables

View Source
var (
	ZeroRID   RID // empty RID, all zeros
	ZeroToken Token
)

var s

View Source
var (
	ErrNotUserID = errors.New("not user id")
	ErrNotKeyID  = errors.New("not key id")
)
View Source
var (
	ErrDangerousRepoPath = errors.New("dangerous or unreachable repository path")
)
View Source
var (
	ErrSyntaxSize = errors.New("size synatx error")
)

Functions

func BufferCat

func BufferCat(sv ...string) []byte

BufferCat todo

func ByteCat

func ByteCat(sv ...[]byte) string

ByteCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.

func DecodeUID

func DecodeUID(glid string) int64

func Du

func Du(path string) (int64, error)

func ErrorCat

func ErrorCat(sv ...string) error

ErrorCat todo

func ExpandPath

func ExpandPath(path string) string

ExpandPath is a helper function to expand a relative or home-relative path to an absolute path.

eg. ~/.someconf -> /home/alec/.someconf

func HumanateSize

func HumanateSize(s int64) string

func HumanateSizeU

func HumanateSizeU(s uint64) string

func NewRID

func NewRID() string

NewRID return RequestID

func NewRandomString

func NewRandomString(length int) string

func NewToken

func NewToken() string

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func ParseKID

func ParseKID(glid string) (int64, error)

func ParseSize

func ParseSize(data string) (int64, error)

func ParseUID

func ParseUID(glid string) (int64, error)

func Remove

func Remove(name string) error

func Rename

func Rename(oldpath, newpath string) error
func ResolveSymbolicLink(path string) (string, error)

ResolveSymbolicLink will follow any symbolic links

func SimpleAtob

func SimpleAtob(s string, dv bool) bool

func SplitPath

func SplitPath(p string) []string

SplitPath skip empty string suggestcap is suggest cap

func StrCat

func StrCat(sv ...string) string

StrCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.

func StrSplitSkipEmpty

func StrSplitSkipEmpty(s string, sep byte, suggestcap int) []string

StrSplitSkipEmpty skip empty string suggestcap is suggest cap

Types

type DiskFreeSpace

type DiskFreeSpace struct {
	Total uint64
	Used  uint64
	Free  uint64
	Avail uint64
	FS    string
}

func GetDiskFreeSpaceEx

func GetDiskFreeSpaceEx(mountPath string) (*DiskFreeSpace, error)

type LimitWriter

type LimitWriter struct {
	// contains filtered or unexported fields
}

func NewLimitWriter

func NewLimitWriter(dst io.Writer, limit int) *LimitWriter

NewLimitWriter create a new LimitWriter that accepts at most 'limit' bytes.

func (*LimitWriter) Write

func (w *LimitWriter) Write(p []byte) (int, error)

type RID

type RID [16]byte

RID type

func NewRandom

func NewRandom() (RID, error)

NewRandom random

func NewRandomFromReader

func NewRandomFromReader(r io.Reader) (RID, error)

NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.

func (RID) String

func (rid RID) String() string

String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx , or "" if uuid is invalid.

type Token

type Token [18]byte

Jump to

Keyboard shortcuts

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