Documentation
¶
Index ¶
- Constants
- Variables
- func Base64UrlDecode(seg string) ([]byte, error)
- func Base64UrlEncode(seg []byte) string
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func GetFileSha256(path string) (hash string, err error)
- func GetJwtBySecret(keyBytes []byte, bodyInfo map[string]interface{}) (string, error)
- func GetPidByPort(portNumber int) int
- func GetRandString(l int) string
- func GetSha256(s string) string
- func GetSha256BySecret(secret string, keyBytes []byte) []byte
- func IsPathExists(path string) bool
- func JsonDecodeUseNumber(infoBytes []byte, result interface{}) error
- func KillPid(pid string) error
- func Md5(s string) string
- func Mkdir(path string) error
- func ReadDir(path string, callback func(fileinfo fs.FileInfo)) error
- func ReadFileToString(path string) (string, error)
- func StartBrowserByUrl(url string) error
- type JsonWebToken
- type LogLevel
- type Logger
Constants ¶
View Source
const ( LOG_LEVEL_DEBUG = 0 LOG_LEVEL_INFO = 1 LOG_LEVEL_WARN = 2 LOG_LEVEL_ERROR = 3 )
Variables ¶
Functions ¶
func Base64UrlDecode ¶
Base64UrlDecode Decode JWT specific base64url encoding with padding stripped
func Base64UrlEncode ¶
Base64UrlEncode Encode JWT specific base64url encoding with padding stripped
func GetFileSha256 ¶
GetFileSha256 get SHA256 hash of file.
func GetJwtBySecret ¶
func GetPidByPort ¶ added in v1.0.2
GetPidByPort. 查找端口所属进程的PID。 返回端口号对应的进程PID,若没有找到相关进程,返回-1
func GetRandString ¶
func GetSha256BySecret ¶
GetSha256BySecret get SHA256 hash by Key
func JsonDecodeUseNumber ¶
func ReadFileToString ¶ added in v1.0.2
ReadFileString 读取文件内容
func StartBrowserByUrl ¶ added in v1.0.2
StartBrowserByUrl 打开系统默认浏览器
Types ¶
type JsonWebToken ¶
type JsonWebToken struct {
TokenString string
// contains filtered or unexported fields
}
func (*JsonWebToken) Create ¶
func (j *JsonWebToken) Create(claims map[string]interface{}, expiresin time.Duration) (token string, err error)
Create JsonWebToken string Create(map[string]interface{}{"id": 123456789, "username": "Harvey"}, time.Second*time.Duration(3600))
type Logger ¶ added in v1.0.2
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) CloseLogFile ¶ added in v1.0.2
func (l *Logger) CloseLogFile()
Click to show internal directories.
Click to hide internal directories.