useragent

package
v0.0.0-...-71f1257 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_INTERVAL = int(60 * 24 * 30)
View Source
var DefaultCachePath = os.Getenv("HOME") + "/.local/share/uacache"
View Source
var UA_STAT_URL = "https://raw.githubusercontent.com/Kikobeats/top-user-agents/master/index.json"

This is really bad data as it's very bias, but I am just looking for latest stats at a certain percentage that can prevent staleness detection. I'd like a much better data source

View Source
var UA_URL = "https://omahaproxy.appspot.com/json"

var DEFAULT_INTERVAL = int(10)

Functions

func GetCurrentUA

func GetCurrentUA() (string, error)

func GetRandomUA

func GetRandomUA(filterlinux bool, file string) (string, error)

func SaveUACache

func SaveUACache(file string) error

Types

type ChromeRelease

type ChromeRelease []struct {
	Os       string `json:"os"`
	Versions []struct {
		BranchCommit       string `json:"branch_commit"`
		BranchBasePosition string `json:"branch_base_position"`
		SkiaCommit         string `json:"skia_commit"`
		V8Version          string `json:"v8_version"`
		PreviousVersion    string `json:"previous_version"`
		V8Commit           string `json:"v8_commit"`
		TrueBranch         string `json:"true_branch"`
		PreviousReldate    string `json:"previous_reldate"`
		BranchBaseCommit   string `json:"branch_base_commit"`
		Version            string `json:"version"`
		CurrentReldate     string `json:"current_reldate"`
		CurrentVersion     string `json:"current_version"`
		Os                 string `json:"os"`
		Channel            string `json:"channel"`
		ChromiumCommit     string `json:"chromium_commit"`
	} `json:"versions"`
}

type CommonAgents

type CommonAgents []string

func GetCommonUA

func GetCommonUA() (CommonAgents, error)

type UserAgentCache

type UserAgentCache struct {
	LastUpdate       int
	Interval         int
	LatestUserAgent  string
	CommonUserAgents []string
}

func GetUACache

func GetUACache(file string) (UserAgentCache, error)

Jump to

Keyboard shortcuts

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