Documentation
¶
Overview ¶
- @Author: 2Kil
- @Date: 2024-04-19 10:54:20
- @LastEditors: 2Kil
- @LastEditTime: 2024-10-20 17:02:20
- @Description:tktar
---------------------------------------------- @Author: 2Kil @Date: 2025-09-28 13:46:43 @LastEditors: 2Kil @LastEditTime: 2025-09-28 13:47:13 @Description: 网络相关 ----------------------------------------------
Index ¶
- func BuildTime() string
- func CheckErr(err error, errString ...string) bool
- func Decrypt(priv *PrivateKey, ciphertext []byte) ([]byte, error)
- func Encrypt(pub *PublicKey, plaintext []byte, workFactor int) ([]byte, error)
- func HelperRemoveDuplicates(s []string) []string
- func IsDebug() bool
- func LogFile(logFIle string, systemLog string) (*logger.Logger, error)
- func NetCurl(curlBash string) (int, string)
- func NetParseCurlComd(curlCmd string) (string, string, http.Header, []byte, error)
- func NetProxyCurl(proxy, curlBash string) (int, string)
- func RandAtomic(max int) int
- func RandAtomicRadius(min, max int) int
- func SysGetSerialKey() string
- func TextAesDecrypt(cipherText, key string) string
- func TextAesEncrypt(plainText, key string) string
- func Verify(plaintext []byte, decryptedHash []byte) bool
- type KeyPair
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckErr ¶
*
- @description: 错误检测
- @param {error} err 错误信息
- @param {string} errString 自定义错误提示
- @return {bool} 无错误true 有错误false
func Decrypt ¶ added in v1.0.8
func Decrypt(priv *PrivateKey, ciphertext []byte) ([]byte, error)
---------------------------------------------- @description: 解密(高效) @param {*PrivateKey} priv @param {[]byte} ciphertext @return {*} ----------------------------------------------
func Encrypt ¶ added in v1.0.8
---------------------------------------------- @description: RSA加密 @param {*PublicKey} pub @param {[]byte} plaintext @param {int} workFactor @return {*} ----------------------------------------------
func HelperRemoveDuplicates ¶
*
- @description: 切片去重,去空
- @param {[]string} 待处理的切片
- @return {[]string} 处理后的切片
func IsDebug ¶
func IsDebug() bool
*
- @description: 判断当前环境是否为Debug模式
- @return {bool} true:Debug模式 false:Release模式
func LogFile ¶ added in v1.0.2
*
- @description: 记录日志到文件&系统事件
- @param {string} logFIle
- @param {bool} systemLog true写入系统事件
- @return {*}
func NetCurl ¶ added in v0.1.2
---------------------------------------------- @description: go的curl实现 @param {string} curlBash @return {*} 响应体 ----------------------------------------------
func NetParseCurlComd ¶ added in v0.1.2
---------------------------------------------- @description: 解析curl命令 @param {string} curlCmd @return {*} 请求方法,请求地址,请求头,请求体,错误信息 ----------------------------------------------
func NetProxyCurl ¶ added in v1.0.1
---------------------------------------------- @description: go的curl实现(走代理) @param {*} proxy 代理地址 @param {string} curlBash @return {*} ----------------------------------------------
func RandAtomicRadius ¶
*
- @description: 生成范围内的随机数
- @param {int} min 最小值
- @param {int} max 最大值
- @return {int} 随机数
func TextAesDecrypt ¶
*
- @description: aes解密
- @param {string} 待解密的文本
- @param {string} 密钥
- @return {string} 明文
func TextAesEncrypt ¶
*
- @description: aes加密
- @param {string} 待加密的文本
- @param {string} 16,24,32密钥
- @return {string} 密文
Types ¶
type KeyPair ¶ added in v1.0.8
type KeyPair struct {
PublicKey *PublicKey
PrivateKey *PrivateKey
}
密钥对
func GenerateKeyPair ¶ added in v1.0.8
---------------------------------------------- @description: 生成RSA密钥对 @param {int} bits @return {*} ----------------------------------------------