client

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package client 统一配置解析、SDK client 创建与 required/optional 认证生命周期。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options *invocation.RootOptions, token string) (*javdb.Client, error)

New 读取配置、校验命令行 host 与 proxy、解析运行时,并在 auto 时先完成线路选择,再构造 携带给定 token 的公开 SDK client。固定 host 完全绕过 route cache 与 selector。基线配置在 host/proxy 无副作用校验与 device UUID provision 之后创建;无效 host/proxy 不落盘,选线 失败也不回滚已创建的本机基线状态。

func WithOptionalAuth

func WithOptionalAuth(options *invocation.RootOptions, errOut io.Writer, fn func(*javdb.Client) error) error

WithOptionalAuth 在有 token 时携带默认账户,否则匿名执行;认证失败时保留原有匿名重试。 本地 token 读取先于线路选择,避免只读/匿名命令在离线时被选线失败阻断。

func WithRequiredAuth

func WithRequiredAuth(options *invocation.RootOptions, errOut io.Writer, fn func(*javdb.Client) error) error

WithRequiredAuth 使用默认账户 token 执行 fn;按配置决定是否自动重新登录。 本地账号/token 前置检查先于线路选择:断网或代理不可用时仍先报"请先登录"类错误, 不会因自动选线失败而掩盖认证缺失。错误文本与既有 WithAuthedClient 逐字一致; errOut == nil 时不写提示。

Types

This section is empty.

Jump to

Keyboard shortcuts

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