tkstar

package module
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

README

TkStar

assignment to entry in nil map

Documentation

Overview

  • @Author: 2Kil
  • @Date: 2024-04-19 10:54:20
  • @LastEditors: 2Kil
  • @LastEditTime: 2025-10-21 11:24:39
  • @Description:tktar

---------------------------------------------- @Author: 2Kil @Date: 2025-09-28 13:46:43 @LastEditors: 2Kil @LastEditTime: 2025-09-28 13:47:13 @Description: 网络相关 ----------------------------------------------

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTime

func BuildTime() string

*

  • @description: 输出编译时间
  • @return {string} 当前文件编译时间

func CheckErr

func CheckErr(err error, errString ...string) bool

*

  • @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

func Encrypt(pub *PublicKey, plaintext []byte, workFactor int) ([]byte, error)

---------------------------------------------- @description: RSA加密 @param {*PublicKey} pub @param {[]byte} plaintext @param {int} workFactor @return {*} ----------------------------------------------

func HelperRemoveDuplicates

func HelperRemoveDuplicates(s []string) []string

*

  • @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

func LogFile(logFIle string, systemLog string) (*logger.Logger, error)

*

  • @description: 记录日志到文件&系统事件
  • @param {string} logFIle
  • @param {bool} systemLog true写入系统事件
  • @return {*}

func NetCurl added in v0.1.2

func NetCurl(curlBash string) (int, string)

---------------------------------------------- @description: go的curl实现 @param {string} curlBash @return {*} 响应体 ----------------------------------------------

func NetParseCurlComd added in v0.1.2

func NetParseCurlComd(curlCmd string) (string, string, http.Header, []byte, error)

---------------------------------------------- @description: 解析curl命令 @param {string} curlCmd @return {*} 请求方法,请求地址,请求头,请求体,错误信息 ----------------------------------------------

func NetProxyCurl added in v1.0.1

func NetProxyCurl(proxy, curlBash string) (int, string)

---------------------------------------------- @description: go的curl实现(走代理) @param {*} proxy 代理地址 @param {string} curlBash @return {*} ----------------------------------------------

func RandAtomic

func RandAtomic(max int) int

*

  • @description: 生成随机数
  • @param {int} max 最大值
  • @return {int} 随机数

func RandAtomicRadius

func RandAtomicRadius(min, max int) int

*

  • @description: 生成范围内的随机数
  • @param {int} min 最小值
  • @param {int} max 最大值
  • @return {int} 随机数

func SysGetSerialKey

func SysGetSerialKey() string

*

  • @description: 获取设备硬件码
  • @return {string} 硬件码

func TextAesDecrypt

func TextAesDecrypt(cipherText, key string) string

*

  • @description: aes解密
  • @param {string} 待解密的文本
  • @param {string} 密钥
  • @return {string} 明文

func TextAesEncrypt

func TextAesEncrypt(plainText, key string) string

*

  • @description: aes加密
  • @param {string} 待加密的文本
  • @param {string} 16,24,32密钥
  • @return {string} 密文

func Verify added in v1.0.8

func Verify(plaintext []byte, decryptedHash []byte) bool

---------------------------------------------- @description: 验证哈希匹配 @param {[]byte} plaintext @param {[]byte} decryptedHash @return {*} ----------------------------------------------

Types

type KeyPair added in v1.0.8

type KeyPair struct {
	PublicKey  *PublicKey
	PrivateKey *PrivateKey
}

密钥对

func GenerateKeyPair added in v1.0.8

func GenerateKeyPair(bits int) (*KeyPair, error)

---------------------------------------------- @description: 生成RSA密钥对 @param {int} bits @return {*} ----------------------------------------------

type PrivateKey added in v1.0.8

type PrivateKey struct {
	N *big.Int // 同公钥的N
	D *big.Int // 解密指数
}

type PublicKey added in v1.0.8

type PublicKey struct {
	N *big.Int // 大素数乘积
	E *big.Int // 加密指数
}

Jump to

Keyboard shortcuts

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