Documentation ¶
Index ¶
- func CheckExpired(expireOn string) (bool, error)
- func CheckExpiredKey(key string) error
- func CopyFile(src, dst string, perm fs.FileMode) error
- func GetUserKey(rawKey string) (string, string, error)
- func MakeRandRSAPubKey(t *testing.T) string
- func RegexGroupsMap(regex *regexp.Regexp, data string) map[string]string
- func SaferWriteFile(content []byte, outputFile string, perm fs.FileMode) error
- func ValidateUser(user string) error
- func ValidateUserKey(user, key string) error
- func WriteFile(content []byte, outputFile string, perm fs.FileMode) error
- type SerialPort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExpired ¶
CheckExpired takes a time string and determines if it represents a time in the past.
func CheckExpiredKey ¶
CheckExpiredKey validates whether a key has expired. Keys with invalid expiration formats will result in an error.
func GetUserKey ¶
GetUserKey returns a user and a SSH key if a rawKey has a correct format, nil otherwise. It doesn't validate entries.
func MakeRandRSAPubKey ¶
MakeRandRSAPubKey generates base64 encoded 256 bit RSA public key for use in tests.
func RegexGroupsMap ¶
RegexGroupsMap takes a compiled Regexp and a string data and return a map of groups:data pairs. The compiled regex must contain grouping.
func SaferWriteFile ¶
SaferWriteFile writes to a temporary file and then replaces the expected output file. This prevents other processes from reading partial content while the writer is still writing.
func ValidateUser ¶
ValidateUser checks for the presence of a characters which should not be allowed in a username string, returns an error if any such characters are detected, nil otherwise. Currently, the only banned characters are whitespace characters.
func ValidateUserKey ¶
ValidateUserKey takes an user and a key received from GetUserKey() and validate the user for special characters and the key for expiration
Types ¶
type SerialPort ¶
type SerialPort struct {
Port string
}
SerialPort is a type for writing to a named serial port.