Documentation
¶
Overview ¶
./internal/profile/resolver.go
Index ¶
- func BuildClientProfile(cap *types.CapturedProfile, browserType types.BrowserType, ...) (profiles.ClientProfile, types.BrowserVersion, error)
- func GetLatestChromeProfile() (profiles.ClientProfile, int)
- func LoadCapturedProfile(path string, maxAge time.Duration) (*types.CapturedProfile, bool)
- func ResolveProfile(ctx context.Context, cfg ResolveConfig) (profiles.ClientProfile, types.BrowserVersion)
- func SaveCapturedProfile(path string, cap *types.CapturedProfile) error
- type ResolveConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildClientProfile ¶
func BuildClientProfile(cap *types.CapturedProfile, browserType types.BrowserType, fallbackVer types.BrowserVersion) (profiles.ClientProfile, types.BrowserVersion, error)
BuildClientProfile преобразует сырой CapturedProfile в рабочий profiles.ClientProfile для tls-client. Если в CapturedProfile версия не определена, используется fallbackVer из VersionResolver.
func GetLatestChromeProfile ¶
func GetLatestChromeProfile() (profiles.ClientProfile, int)
GetLatestChromeProfile находит максимально свежий вкомпилированный профиль Chrome в реестре bogdanfinn/tls-client и возвращает его вместе с номером мажорной версии.
func LoadCapturedProfile ¶
LoadCapturedProfile читает слепок из файла кэша.
func ResolveProfile ¶
func ResolveProfile(ctx context.Context, cfg ResolveConfig) (profiles.ClientProfile, types.BrowserVersion)
ResolveProfile выполняет 5-уровневый каскадный поиск эталонного профиля.
func SaveCapturedProfile ¶
func SaveCapturedProfile(path string, cap *types.CapturedProfile) error
SaveCapturedProfile сохраняет слепок в файл кэша.
Types ¶
type ResolveConfig ¶
type ResolveConfig struct {
CachePath string
CacheTTL time.Duration
BrowserType types.BrowserType
FallbackVersion types.BrowserVersion
GitHubRepo string // Репозиторий проекта, например "imbecility/httpclient"
RemoteManifestURLs []string
DisableLocalProbe bool
DisableExternalProbe bool
}
ResolveConfig содержит настройки для каскадного получения отпечатка.