rules

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTH_HDR_AMZ_SHA256 = "X-Amz-Content-Sha256"
	AUTH_HDR_AMZ_DATE   = "X-Amz-Date"
	AUTH_HDR_AMZ_TOKEN  = "X-Amz-Security-Token"
	AUTH_HDR_AMZ_AUTH   = "Authorization"
)

Variables

View Source
var (
	ErrPrefixMatch         = errors.New("url does not match prefix")
	ErrInvalidDownloadPath = errors.New("invalid download path")
)
View Source
var (
	ErrInvalidResponse   = errors.New("invalid response")
	ErrNoRulesRelease    = errors.New("no rules release found")
	ErrNoVersion         = errors.New("no version found")
	ErrTimeout           = errors.New("timeout")
	ErrHashMismatch      = errors.New("hash mismatch")
	ErrInvalidKey        = errors.New("invalid public key")
	ErrInvalidUpdate     = errors.New("invalid update")
	ErrNoRules           = errors.New("no rules")
	ErrInvalidSignature  = errors.New("invalid signature")
	ErrUpdateExeFailed   = errors.New("exe update failed")
	ErrUpdateRulesFailed = errors.New("rules update failed")
)

Functions

func GetCurrentRulesVersion

func GetCurrentRulesVersion(configDir string) (*semver.Version, string, error)

func GetRules

func GetRules(ctx context.Context, conf *config.Config, configDir, cmdLineRules, token, ruleUpdateFile, baseAddr string, tlsPort, udpPort int) ([]utils.RulePathT, error)

Types

type PackageUrls

type PackageUrls struct {
	DataUrl  string `json:"du,omitempty"`
	DataSize int64  `json:"ds,omitempty"`
	Hash     string `json:"h,omitempty"`
	HashUrl  string `json:"hu,omitempty"`
	HashSize int64  `json:"hs,omitempty"`
	SigUrl   string `json:"su,omitempty"`
	SigSize  int64  `json:"ss,omitempty"`
	Os       string `json:"os,omitempty"`
	Arch     string `json:"arch,omitempty"`
}

type RuleUpdateResponse

type RuleUpdateResponse struct {
	LatestRuleVersion string         `json:"rv,omitempty"`
	LatestRuleHash    string         `json:"rh,omitempty"`
	LatestExeVersion  string         `json:"ex,omitempty"`
	RuleUrls          *PackageUrls   `json:"ru,omitempty"`
	ExeUrls           []*PackageUrls `json:"eu,omitempty"`
}

type RulesDownload

type RulesDownload struct {
	RulesPackage string `json:"rules_package"`
}

type RulesDownloadAuth

type RulesDownloadAuth struct {
	Token  string `json:"token"`
	Auth   string `json:"authorization"`
	Sha256 string `json:"sha256"`
	Date   string `json:"date"`
}

type RulesWhoAmI

type RulesWhoAmI struct {
	Os          string `json:"os"`
	Version     string `json:"version"`
	GitHash     string `json:"git_hash"`
	RuleVersion string `json:"rule_version"`
	Timezone    string `json:"timezone"`
}

Jump to

Keyboard shortcuts

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