Documentation
¶
Index ¶
- func InterpreterHash(source []byte) string
- type Challenge
- type Options
- type Profile
- type Runtime
- func (runtime *Runtime) Close()
- func (runtime *Runtime) Proof(ctx context.Context, digest string, prompt string) (string, error)
- func (runtime *Runtime) RefreshSnapshot(ctx context.Context) (string, error)
- func (runtime *Runtime) RunProof(ctx context.Context, digest string, prompt string) (string, error)
- func (runtime *Runtime) Settle(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterpreterHash ¶
InterpreterHash 返回解释器源码的 SHA-256 base64url 摘要
Types ¶
type Challenge ¶
type Challenge struct {
MessageID string
InterpreterJavaScript string
InterpreterURL string
InterpreterHash string
Program string
GlobalName string
ClientExperimentsStateBlob string
}
Challenge 保存 Waa/Create 返回的客户端解释器输入
func ParseChallenge ¶
ParseChallenge 解析 Waa/Create 响应,第 2 字段的混淆 challenge 为空时读取第 1 字段的明文 challenge
type Options ¶
type Options struct {
Challenge Challenge
Interpreter string
Profile Profile
LoadImage func(string) bool
// LoadFrame 以浏览器 iframe 导航形状载入地址,返回是否收到文档响应
LoadFrame func(string) bool
}
Options 定义一份 BotGuard VM 的解释器、宿主现场与网络依赖
type Profile ¶
type Profile struct {
PageURL string
Locale string
TimeZone string
Window map[string]any
Screen map[string]any
Document map[string]any
Globals map[string]any
LocalStorage map[string]string
HasFocus bool
// TrustedTypes 表示页面 CSP 要求脚本注入点使用 Trusted Types
TrustedTypes bool
NavigationStart time.Time
}
Profile 保存账户指纹与页面状态决定的宿主现场值
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime 在嵌入的 SpiderMonkey 中持有一份与官网页面同形态的 BotGuard 生命周期
func NewRuntime ¶
NewRuntime 在 Firefox 宿主中加载解释器并初始化 challenge program
func (*Runtime) RefreshSnapshot ¶
RefreshSnapshot 生成官网刷新 Waa/Create 时携带的无绑定 snapshot