pkg

module
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT

README

pkg

敏捷开发软件包

最低 Go 版本: 1.27

生产契约

以下语义已在生产主模块和启动链上冻结, 不能顺手改算法或输出:

  • xcrypto.Encrypt / Decrypt / GetenvDecrypt: AES-CBC + MD5 派生密钥 + base58, 默认 IV 为 key[:blockSize]
  • xcrypto.Seal / Open / SealString / OpenString: 新的通用 AEAD, AES-GCM, 随机 12 字节 nonce, 与 Encrypt 独立
  • utils.ToLower / ToUpper / Trim* / EqualFoldBytes: ASCII 语义, 不是 Unicode
  • xhash.HashString64 / Sum32: 稳定 FNV, 不是 per-process maphash
  • utils.FastIntn / FastRand / Rand: runtime fastrand + math/rand v1, 不是密码学随机

细节见本地 docs/features/merge-utils-go126-plan.md. docs/ 仅作本地技术留底, 不纳入 pkg 提交.

时间与时区

应用在 common/master 受控启动初始化成功后默认固定 UTC+8, 不依赖宿主时区或 TZ; 可提前设置 config.DefaultTimeLocation 选择其他时区. 仅导入 pkg 不会改写全局时区, 不支持运行期切换.

完整用法、纽约极简示例及启动安全边界见 时区配置与美国时区示例.

部署

.
├── bin
│   └── ffapp
├── env
│   └── ffapp.env
├── etc
│   └── ffapp.json
└── log
    ├── daemon.log
    └── ffapp.log

示例

见: 应用规范范本 和 多服务示例.

Fiber 的请求体上限、代理 IP 验证、超时日志及 HTTPS 行为见 Fiber 封装说明.

原生 SQL 按需使用 sqldb 事务与结果集助手, 可运行 SQLite 内存数据库示例.

敏感信息加密

见: tools/README.md

ff

Directories

Path Synopsis
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package base58 provides an API for working with modified base58 and Base58Check encodings.
examples
multiserver command
演示在同一应用中, 使用不同配置 (Name, 端口) 同时启动多个 Web 服务.
演示在同一应用中, 使用不同配置 (Name, 端口) 同时启动多个 Web 服务.
timezone command
演示在业务启动前统一使用美国纽约时区, 不读取配置文件或启动常驻服务.
演示在业务启动前统一使用美国纽约时区, 不读取配置文件或启动常驻服务.
Package generic defines a set of useful constraints to be used with type parameters.
Package generic defines a set of useful constraints to be used with type parameters.
internal
ntp
Package ntp provides an implementation of a Simple NTP (SNTP) client capable of querying the current time from a remote NTP server.
Package ntp provides an implementation of a Simple NTP (SNTP) client capable of querying the current time from a remote NTP server.
Package kit Reference: https://github.com/puzpuzpuz/xsync/blob/main/counter.go A Counter is a striped int64 counter inspired by the j.u.c.a.LongAdder class from the Java standard library.
Package kit Reference: https://github.com/puzpuzpuz/xsync/blob/main/counter.go A Counter is a striped int64 counter inspired by the j.u.c.a.LongAdder class from the Java standard library.
pools
Package pubsub implements a simple multi-topic pub-sub library.
Package pubsub implements a simple multi-topic pub-sub library.
Package sqldb 提供 database/sql 的事务和结果集生命周期助手.
Package sqldb 提供 database/sql 的事务和结果集生命周期助手.
web
Package xid is a globally unique id generator suited for web scale
Package xid is a globally unique id generator suited for web scale
xjson
gjson
Package gjson provides searching for json strings.
Package gjson provides searching for json strings.
jsongen
Package jsongen forked from darjun/json-gen
Package jsongen forked from darjun/json-gen
match
Package match provides a simple pattern matcher with unicode support.
Package match provides a simple pattern matcher with unicode support.
sjson
Package sjson provides setting json values.
Package sjson provides setting json values.
Package xsign 提供两类签名, 都不是加密, 也不能替换 xcrypto.Encrypt / Seal.
Package xsign 提供两类签名, 都不是加密, 也不能替换 xcrypto.Encrypt / Seal.

Jump to

Keyboard shortcuts

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