util

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEYCTL_PERM_VIEW    = uint32(1 << 0)
	KEYCTL_PERM_READ    = uint32(1 << 1)
	KEYCTL_PERM_WRITE   = uint32(1 << 2)
	KEYCTL_PERM_SEARCH  = uint32(1 << 3)
	KEYCTL_PERM_LINK    = uint32(1 << 4)
	KEYCTL_PERM_SETATTR = uint32(1 << 5)
	KEYCTL_PERM_ALL     = uint32((1 << 6) - 1)

	KEYCTL_PERM_OTHERS  = 0
	KEYCTL_PERM_GROUP   = 8
	KEYCTL_PERM_USER    = 16
	KEYCTL_PERM_PROCESS = 24
)

Variables

View Source
var Config = keyring.Config{
	AllowedBackends:                keyring.AvailableBackends(),
	FileDir:                        "~/.config/ldap-cli",
	FilePasswordFunc:               passwordFunc,
	KeyCtlScope:                    "user",
	KeyCtlPerm:                     (KEYCTL_PERM_ALL << KEYCTL_PERM_USER) | (KEYCTL_PERM_ALL << KEYCTL_PERM_PROCESS),
	KeychainAccessibleWhenUnlocked: true,
	KeychainName:                   "ldap-cli",
	KeychainPasswordFunc:           passwordFunc,
	KeychainSynchronizable:         false,
	KeychainTrustApplication:       true,
	KWalletAppID:                   "ldap-cli",
	KWalletFolder:                  "ldap-cli",
	LibSecretCollectionName:        "ldap-cli",
	PassCmd:                        "pass",
	PassDir:                        "~/.password-store",
	PassPrefix:                     "ldap-cli.",
	ServiceName:                    "ldap-cli",
	WinCredPrefix:                  "ldap-cli.",
}

Config is the configuration for the keyring

View Source
var ErrAuthenticationFailed = errors.New("authentication failed")
View Source
var ErrInvalidFilter = errors.New("invalid filter syntax")
View Source
var ErrNetworkFailure = errors.New("network error")
View Source
var ErrNothingReturned = errors.New("nothing returned")
View Source
var ErrOperationFailed = errors.New("query failed")
View Source
var ErrQuotaExceeded = errors.New("quota limit exceed")
View Source
var ErrUbiquitousResults = errors.New("ubiquitous response")
View Source
var Time1601 = time.Date(1601, time.January, 1, 0, 0, 0, 0, time.UTC)

Epoch start date: 1601-01-01 00:00:00 UTC

Functions

func FormatError

func FormatError(err error) error

FormatError formats a validation error

func GetExecutablePath

func GetExecutablePath() string

Get path of the executable that started current gr process.

func GetFromKeyring added in v1.2.3

func GetFromKeyring(key string) (string, error)

GetFromKeyring retrieves a value from the keyring

func Handle

func Handle(err error) error

Handle maps LDAP errors to more specific errors

func Hexify

func Hexify(s string) string

Hexify converts a string to a hex representation

func LookupAddress

func LookupAddress(address string) string

Resolve Internet Protocol address to domain name

func NewGUID

func NewGUID() string

NewGUID generates a new GUID

func RebuildStringSliceFlag

func RebuildStringSliceFlag(flags []string, delimiter rune) ([]string, error)

Parse string slice or string array flags by using custom csv reader

func RemoveFromKeyRing added in v1.2.3

func RemoveFromKeyRing(key string) error

RemoveFromKeyRing removes a value from the keyring

func SetToKeyring added in v1.2.3

func SetToKeyring(key, value string) error

SetToKeyring sets a value to the keyring

func SkipOAT

func SkipOAT(t testing.TB)

SkipOAT skips the test if TEST_OAT is not set to true

func TimeAfter1601

func TimeAfter1601(offset int64) time.Time

Retrieve date by applying offset. It should be in 0.1 µs

func TimeSince1601

func TimeSince1601() time.Duration

Retrieve current time since 1601-01-01 00:00:00 UTC

func ToTitleNoLower

func ToTitleNoLower(in string) string

Convert English words to title case (prevent lowercasing)

func Unhexify

func Unhexify(s string) string

Unhexify converts a hex representation to a string

func Validate

func Validate() *validator.Validate

Validate returns a validator instance

Types

type ValidatorInterface

type ValidatorInterface interface {
	IsValid() bool
}

ValidatorInterface is an interface for validating structs

Jump to

Keyboard shortcuts

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