Documentation
¶
Index ¶
- Variables
- func Call[T any](action Action) (*T, error)
- func ExportGoStructs(packageName string) string
- func GetActionConfig(actionName string) (map[string]any, []*safe.SafeBuf)
- func GetBytesOrSafe(v any) ([]byte, func())
- func GetManifest() map[string]any
- func GetStringOrSafe(v any) (string, func())
- func Load(name string) error
- func MergeMap(dst, src map[string]any)
- func RegisterSigner(name string, s Signer)
- func SetEncryptKeys(key, iv []byte)
- type Action
- type ConfigurableAction
- type HttpRequest
- type MethodAction
- type Result
- type Signer
- type SignerAction
- type URLAction
- type ValidatableAction
Constants ¶
This section is empty.
Variables ¶
var GlobalConfigs = map[string]any{}
GlobalConfigs 存储整棵配置树
Functions ¶
func ExportGoStructs ¶
ExportGoStructs 根据全局配置生成 Go 结构体代码
func GetActionConfig ¶
GetActionConfig 获取某个动作经过层级合并后的完整配置,返回配置图和需要手动关闭的 SafeBuf 列表
func GetBytesOrSafe ¶ added in v1.0.3
GetBytesOrSafe 从配置中安全地获取字节切片。如果是 SafeBuf,则返回明文副本及对应的清理函数
func GetStringOrSafe ¶ added in v1.0.3
GetStringOrSafe 从配置中安全地获取字符串值。如果是 SafeBuf,则返回明文副本及对应的清理函数
Types ¶
type Action ¶
type Action interface {
ActionName() string // 例如: "tencent.sms.send"
}
Action 是所有接口的基础标识接口
type ConfigurableAction ¶
ConfigurableAction 定义可以提供默认硬编码配置的动作
type HttpRequest ¶
type HttpRequest struct {
Url string
Method string
Payload any
// contains filtered or unexported fields
}
HttpRequest 内部使用的请求描述结构,供 Signer 使用
func (*HttpRequest) Close ¶ added in v1.0.3
func (r *HttpRequest) Close()
Close 物理覆盖并清除所有关联的敏感缓冲区,确保内存中不再留存明文
func (*HttpRequest) GetHeader ¶ added in v1.0.3
func (r *HttpRequest) GetHeader(key string) string
GetHeader 获取指定 Header 的值
func (*HttpRequest) SetHeader ¶ added in v1.0.3
func (r *HttpRequest) SetHeader(key string, values ...any)
SetHeader 提供无感知的安全 Header 设置功能。支持传入多个参数进行自动拼接。 如果参数中包含 *safe.SafeBuf, *safe.SecretPlaintext 或 []byte (标记为敏感), 整个生成的 Header 缓冲区都将被注册用于后置物理擦除。 安全的拼接与转换(如 safe.Concat, safe.Base64)建议使用 safe 包提供的返回 *safe.SafeBuf 的方法。
type MethodAction ¶
type MethodAction interface {
GetMethod() string // 例如: "GET"
}
MethodAction 定义显式指定方法的动作
type Signer ¶
type Signer interface {
Sign(req *HttpRequest, config map[string]any) error
}
Signer 负责为请求附加签名信息
type SignerAction ¶
type SignerAction interface {
SignerName() string // 例如: "tc3"
}
SignerAction 定义需要签名的动作
type ValidatableAction ¶
type ValidatableAction interface {
Validate() error
}
ValidatableAction 定义支持自我校验的动作