Documentation ¶
Index ¶
- func Abs(x int) int
- func Base64Decode(data string) ([]byte, error)
- func Base64Encode(data []byte) string
- func BlobToPEMString(blob []byte) string
- func BytesToStr(byteArray []byte, delimiter string) string
- func CalcHashPW(password_A, password_B []byte) (string, string, error)
- func CalcXorByteArrays(a, b []byte) ([]byte, error)
- func CompareHashAndPassword(hashedPassword, password string) error
- func GenerateHashFromPassword(data []byte) ([]byte, error)
- func GenerateRandom(length int) ([]byte, error)
- func GetCurrentTimestamp() string
- func LoadCertFromFile(configDir, filename string) (*x509.Certificate, error)
- func LoadConfig(configDir, configFile string, v interface{}) error
- func LoadJSONConfig(configPath string, v interface{}) error
- func NumToStr(byteArray []byte, isBigEndian bool) string
- func PrintVersion(exit bool) string
- func ReadFile(filename string) ([]byte, error)
- func ReadFileFromDir(configDir, filename string) ([]byte, error)
- func WriteFile(name string, data []byte, perm os.FileMode) error
- func WriteFileToDir(configDir, filename string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func BlobToPEMString ¶
func BytesToStr ¶
func CalcHashPW ¶
CalcHashPW returns a hash string value.
func CalcXorByteArrays ¶
func CompareHashAndPassword ¶
func GenerateRandom ¶
GenerateRandom returns random data from the rand package.
func GetCurrentTimestamp ¶
func GetCurrentTimestamp() string
func LoadCertFromFile ¶
func LoadCertFromFile(configDir, filename string) (*x509.Certificate, error)
LoadCertFromFile reads a yaml configuration file from the specified path and parse it into the certificate object.
Parameters:
- configDir: The directory path of the Yaml configuration file.
- filename: The filename.
Returns:
- A pointer to the X509 certificate struct where the configuration will be parsed.
- An error if there was an issue reading or unmarshaling the configuration file.
func LoadConfig ¶
LoadConfig reads a Yaml configuration file from the specified path with filename and unmarshals it into the provided struct (v).
Parameters:
- configDir: The directory path of the Yaml configuration file.
- configFile: The file path of the Yaml configuration file.
- v: A pointer to the struct where the configuration will be unmarshaled.
Returns:
- An error if there was an issue reading or unmarshaling the configuration file.
func LoadJSONConfig ¶
LoadJSONConfig reads a JSON configuration file from the specified path and unmarshals it into the provided struct (v).
Parameters:
- configPath: The file path of the JSON configuration file.
- v: A pointer to the struct where the configuration will be unmarshaled.
Returns:
- An error if there was an issue reading or unmarshaling the configuration file.
func PrintVersion ¶
func ReadFile ¶
ReadFile reads data from file. If succeed, ReadFile returns the data of the file as byte array; otherwise ReadFile returns an error.
func ReadFileFromDir ¶
func WriteFile ¶
WriteFile writes data to the named file, creating it if necessary. If the file does not exist, WriteFile creates it with permissions perm (before umask); otherwise WriteFile appends it before writing, without changing permissions.
func WriteFileToDir ¶
Types ¶
This section is empty.