Documentation
¶
Index ¶
- Constants
- func GetExecutableDir() string
- func GetExecutablePath() string
- func PrefixFromPublicKey(pub any) ([]byte, error)
- type Blocklist
- type Cache
- func (cache *Cache) CreateFile(path string) (io.WriteCloser, error)
- func (cache *Cache) CurrentMetadata() (*Meta, error)
- func (cache *Cache) DownloadAndValidateXZ(u string, hash string, path string) error
- func (cache *Cache) GetCacheDir() string
- func (cache *Cache) LoadBlocklist() (*Blocklist, error)
- func (cache *Cache) OpenFile(path string) (io.ReadCloser, error)
- func (cache *Cache) RemoveFile(path string) error
- func (cache *Cache) RenameFile(src string, dst string) error
- func (cache *Cache) SetCacheDir(s string)
- func (cache *Cache) Update() (string, string, error)
- type Dirs
- type Meta
- type Paths
- type Repo
- type Repos
- type Result
Constants ¶
View Source
const BadKeysMetaURL = "https://update.badkeys.info/v0/badkeysdata.json"
View Source
const BlockHashPrefix = 15
View Source
const BlockLength = 16
View Source
const CacheFileBlocklist = "blocklist.dat"
View Source
const CacheFileLookup = "lookup.txt"
View Source
const CacheFileMetadata = "badkeysdata.json"
View Source
const HTTPDataDownloadTimeout = time.Hour
View Source
const HTTPMetaDownloadTimeout = time.Second * 30
View Source
const MaxLookupLine = 4096
View Source
const MaxResponseSize = 1024 * 1024 * 512 // Adjust if the block list becomes larger
Variables ¶
This section is empty.
Functions ¶
func GetExecutableDir ¶ added in v0.0.2
func GetExecutableDir() string
GetExecutableDir returns the full path to the running binary's directory
func GetExecutablePath ¶ added in v0.0.2
func GetExecutablePath() string
GetExecutablePath returns the full path to the running binary
func PrefixFromPublicKey ¶
PrefixFromPublicKey implements the badkeys `blocklistmaker` hashing method
Types ¶
type Blocklist ¶ added in v0.0.2
type Blocklist struct {
Meta *Meta
Blocks []byte
Repos Repos
LookupMap map[uint64][]int
LookupStrings []string
Error error
}
func NewBlocklist ¶ added in v0.0.2
func NewBlocklist() *Blocklist
type Cache ¶ added in v0.0.2
type Cache struct {
sync.Mutex
Blocklist *Blocklist
LoadError error
// contains filtered or unexported fields
}
func (*Cache) CreateFile ¶ added in v0.0.2
func (cache *Cache) CreateFile(path string) (io.WriteCloser, error)
CreateFile returns a writer for the given cache file name
func (*Cache) CurrentMetadata ¶ added in v0.0.2
func (*Cache) DownloadAndValidateXZ ¶ added in v0.0.2
func (*Cache) GetCacheDir ¶ added in v0.0.2
GetCacheDir returns the location of the badkeys block tables
func (*Cache) LoadBlocklist ¶ added in v0.0.2
LoadBlocklist loads the blocklist from disk if necessary
func (*Cache) OpenFile ¶ added in v0.0.2
func (cache *Cache) OpenFile(path string) (io.ReadCloser, error)
OpenFile returns a reader for the given cache file name
func (*Cache) RemoveFile ¶ added in v0.0.2
RemoveFile deletes a file from the cache
func (*Cache) RenameFile ¶ added in v0.0.2
RenameFile replaces one file with another in the caache
func (*Cache) SetCacheDir ¶ added in v0.0.2
SetCacheDir sets the location of the badkeys block tables
type Meta ¶
type Meta struct {
BKFormat int `json:"bkformat,omitempty"`
Date string `json:"date,omitempty"`
BlocklistURL string `json:"blocklist_url,omitempty"`
BlocklistSHA256 string `json:"blocklist_sha256,omitempty"`
LookupURL string `json:"lookup_url,omitempty"`
LookupSHA256 string `json:"lookup_sha256,omitempty"`
Blocklists []Repo `json:"blocklists,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.