updateutils

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Organization = "wjlin0"
)

Variables

View Source
var (
	// By default when tool is updated release notes of latest version are printed
	HideReleaseNotes      = false
	HideProgressBar       = false
	VersionCheckTimeout   = time.Duration(5) * time.Second
	DownloadUpdateTimeout = time.Duration(30) * time.Second
	// Note: DefaultHttpClient is only used in GetToolVersionCallback
	DefaultHttpClient *http.Client
)

Functions

func GetToolVersionCallback

func GetToolVersionCallback(toolName, repoName string) func() (string, error)

GetToolVersionCallback returns a callback function that checks for updates of tool by sending a request to update check endpoint and returns latest version if repoName is empty then tool name is considered as repoName

func GetUpdateDirFromRepoCallback

func GetUpdateDirFromRepoCallback(toolName, dir, repoName string) func() error

func GetUpdateDirFromRepoNoErrCallback

func GetUpdateDirFromRepoNoErrCallback(toolName, dir, repoName string) func()

func GetUpdateToolCallback

func GetUpdateToolCallback(toolName, version string) func()

GetUpdateToolCallback returns a callback function that updates given tool if given version is older than latest gh release and exits

func GetUpdateToolFromRepoCallback

func GetUpdateToolFromRepoCallback(toolName, version, repoName string) func()

GetUpdateToolWithRepoCallback returns a callback function that is similar to GetUpdateToolCallback but it takes repoName as an argument (repoName can be either just repoName ex: `nuclei` or full repo Addr ex: `projectdiscovery/nuclei`)

func GetVersionDescription

func GetVersionDescription(current string, latest string) string

GetVersionDescription returns tags like (latest) or (outdated) or (dev)

func GetpdtmParams

func GetpdtmParams(version string) string

GetpdtmParams returns encoded query parameters sent to update check endpoint

func IsDevReleaseOutdated

func IsDevReleaseOutdated(current string, latest string) bool

IsDevReleaseOutdated returns true if installed tool (dev version) is outdated ex: if installed tools is v2.9.1-dev and latest release is v2.9.1 then it is outdated since v2.9.1-dev is released and merged into main/master branch

func IsOutdated

func IsOutdated(current, latest string) bool

IsOutdated returns true if current version is outdated

Types

type AssetFormat

type AssetFormat uint
const (
	Zip AssetFormat = iota
	Tar
	Unknown
)

func IdentifyAssetFormat

func IdentifyAssetFormat(assetName string) AssetFormat

func (AssetFormat) FileExtension

func (a AssetFormat) FileExtension() string

FileExtension of this asset format

type Tool

type Tool struct {
	Name    string            `json:"name"`
	Repo    string            `json:"repo"`
	Version string            `json:"version"`
	Assets  map[string]string `json:"assets"`
}

Tool

Jump to

Keyboard shortcuts

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