fix(sdk): 离线 license 默认自动校验机器指纹
- 新增 sdk.MachineFingerprint:Linux machine-id+DMI、macOS IOPlatformUUID,容器内 fail-closed - 文件模式在 bind.fp 存在时自动校验,无需显式 WithFingerprint;采集失败拒绝绑定 license - 新增 WithFingerprintFunc 支持容器读取挂载宿主 machine-id;在线激活同步使用自动指纹 - license 包新增 NormalizeFingerprint(sha256:64hex 校验与小写归一化) - 新增指纹绑定/采集失败/无绑定跳过等测试
This commit is contained in:
10 files changed
+433
-21
No files matched your search
@@ -0,0 +1,14 @@
|
||||
//go:build !linux && !darwin
|
||||
|
||||
package sdk
|
||||
|
||||
import "errors"
|
||||
|
||||
// machineFields 其他平台暂无稳定硬件标识采集实现:仅使用 hostname 兜底。
|
||||
// 生产接入应通过 WithFingerprint 或 WithFingerprintFunc 注入平台特定标识。
|
||||
func machineFields() ([]string, error) {
|
||||
if h := hostname(); h != "" && h != "unknown" {
|
||||
return []string{"hostname:" + h}, nil
|
||||
}
|
||||
return nil, errors.New("sdk: 当前平台无法采集机器标识")
|
||||
}
|
||||
Reference in new issue
Block a user