Categorygithub.com/prestonTao/utils
modulepackage
0.0.0-20220527083919-cd2f09fb8f62
Repository: https://github.com/prestontao/utils.git
Documentation: pkg.go.dev

# README

utils

# Packages

No description provided by the author
No description provided by the author

# Functions

添加一个定时任务 @tick int64 未来的某个时刻,例如(未来10秒钟后执行):time.Now().Unix()+int64(10) */.
AppCode checks whether a multihash code is part of the App range.
创建一对密钥,私钥已经加密,公钥不需要加密 */.
No description provided by the author
构建默克尔树根 */.
把[]byte转换为string,只要性能,不在乎可读性 */.
byte转int64.
byte转uint16 */.
byte转uint64.
byte转uint64.
Cast casts a buffer onto a multihash, and returns an error if it does not work.
No description provided by the author
把一个对象转换成map */.
检查是否完成工作.
检查目录是否存在,不存在则创建 */.
检查hash值是否有足够多的前导零 @code string Hash值 @zeroes uint64 前导零个数 */.
No description provided by the author
No description provided by the author
Decode parses multihash bytes into a DecodedMultihash.
解析pem公钥.
No description provided by the author
No description provided by the author
No description provided by the author
Encode a hash digest along with the specified function code.
EncodeName is like Encode() but providing a string name instead of a numeric code.
No description provided by the author
对私钥加密 */.
把文件全路径切分成子路径 */.
计算文件的hash值 */.
格式化id为十进制或十六进制字符串 */.
No description provided by the author
FromB58String parses a B58-encoded multihash.
No description provided by the author
FromHexString parses a hex-encoded multihash.
No description provided by the author
高位补零 */.
生成私钥和公钥文件到本地 */.
生成私钥 */.
获得累加器的值 */.
获得一个可用的TCP端口 */.
获得一个可用的UDP端口 */.
No description provided by the author
获得域名的hash值 */.
通过一个域名和用户名得到节点的id@return 10进制字符串.
不联网的情况下,得到本机ip地址 */.
获取本机能联网的ip地址 @return string 获得的ip地址 @return bool 是否能联网 */.
获取时间 */.
获得一个随机数(0 - n],包含0,不包含n */.
随机获取一个域名 */.
随机获取一个int64类型的随机数 */.
创建一个等待关机命令服务 */.
获得一个TCP监听 */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
初始化ledis数据库.
int64转byte.
Long2IPString 把数值转为ip字符串.
IPString2Long 把ip字符串转为数值.
是全球唯一ip */.
将加密秘钥填补成16字节长度 */.
加载本地私钥 */.
加载本地公钥 */.
No description provided by the author
No description provided by the author
递归创建目录 */.
间隔n秒后发送一个信号 */.
No description provided by the author
New creates a new Cache.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
-----BEGIN EC PRIVATE KEY----- MIHcAgEBBEIAJuVZ2ujd64R6iA3mJ2Iuaorwc3kUXihcLvF51nuF8MHE82ZobU4k JBwOjjFX1jjZGDAyiIgXpD9HXtfIWCpIksigBwYFK4EEACOhgYkDgYYABAB7ZnsN kzgg7JrVxohq2FOxRpA+bUsVsxHKHRur0ezttNRu7ldR36fGgyztoplyUltUndID 7EEi2o9z2E4q99ozOgHwbHnx5WROGYtwvdwDQtvHnCynzO7eixMFZ8pKLddz7YLs hm8sApO1ZneSDMMBoKhtlX4+pywXZ91WxEfOY/GXlA== -----END EC PRIVATE KEY----- 将这种格式的[]byte,去掉头和尾后拼接中间的字符 */.
No description provided by the author
No description provided by the author
判断一个路径的文件是否存在 */.
No description provided by the author
go tool pprof -http 127.0.0.1:8081 .\mem.prof.
No description provided by the author
错误处理 */.
字符串中随机选择一个 */.
No description provided by the author
保存文件 保存文件步骤: 1.创建临时文件 2.
保存对象为json格式 */.
No description provided by the author
对内容生成签名 */.
s256签名.
No description provided by the author
No description provided by the author
No description provided by the author
发送停止命令 */.
No description provided by the author
No description provided by the author
uint16转byte */.
uint64转byte.
uint64转byte.
ValidCode checks whether a multihash code is valid.
Verify 对密文和明文进行匹配校验.
验证s256签名.
开始工作,猜解一段字符串hash后有足够个0目前(2014年)一般计算机计算出20个0大约一百万次,用时3.0121722秒.

# Constants

constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.
constants.

# Variables

Codes maps a hash code to it's name.
DefaultLengths maps a hash code to it's default length.
errors.
errors.
errors.
errors.
errors.
errors.
errors.
No description provided by the author
Names maps the name of a hash to the code.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
Cache is an LRU cache.
DBConn leveldb 连接.
DecodedMultihash represents a parsed multihash and allows easy access to the different parts of a multihash.
ErrInconsistentLen is returned when a decoded multihash has an inconsistent length.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

A Key may be any value that is comparable.

# Type aliases

Multihash is byte slice with the following form: <hash function code><digest size><hash function output>.
No description provided by the author