MCPcopy
hub / github.com/safing/portmaster / LoadIndex

Function LoadIndex

service/updates/index.go:137–146  ·  view source on GitHub ↗

LoadIndex loads and parses an index from the given filename. Leave platform empty to use current platform.

(filename string, platform string, trustStore jess.TrustStore)

Source from the content-addressed store, hash-verified

135// LoadIndex loads and parses an index from the given filename.
136// Leave platform empty to use current platform.
137func LoadIndex(filename string, platform string, trustStore jess.TrustStore) (*Index, error) {
138 // Read index file from disk.
139 content, err := os.ReadFile(filename)
140 if err != nil {
141 return nil, fmt.Errorf("read index file: %w", err)
142 }
143
144 // Parse and return.
145 return ParseIndex(content, platform, trustStore)
146}
147
148// ParseIndex parses an index from a json string.
149// Leave platform empty to use current platform.

Callers 3

NewFunction · 0.85
updateAndUpgradeMethod · 0.85
TestPerformUpdateFunction · 0.85

Calls 2

ParseIndexFunction · 0.85
ErrorfMethod · 0.80

Tested by 1

TestPerformUpdateFunction · 0.68