MCPcopy Create free account
hub / github.com/cnshym/httpgo / LoadFingerprints

Function LoadFingerprints

pkg/utils/file.go:19–37  ·  view source on GitHub ↗

获取指纹规则

(filePath string)

Source from the content-addressed store, hash-verified

17
18// 获取指纹规则
19func LoadFingerprints(filePath string) ([]FingerprintFile, error) {
20 file, err := os.Open(filePath)
21 if err != nil {
22 return nil, fmt.Errorf("failed to open file: %v", err)
23 }
24 defer file.Close()
25
26 data, err := ioutil.ReadAll(file)
27 if err != nil {
28 return nil, fmt.Errorf("failed to read file: %v", err)
29 }
30 var fingerprints []FingerprintFile
31 err = json.Unmarshal(data, &fingerprints)
32 if err != nil {
33 return nil, fmt.Errorf("error unmarshalling JSON data: %v", err)
34 }
35
36 return fingerprints, nil
37}
38
39// 获取文件内容为string类型
40func ReadFileToString(filePath string) (string, error) {

Callers 1

mainFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected