forked from google/syzkaller
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.go
61 lines (53 loc) · 1.16 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package config
import (
"io/ioutil"
"github.com/Sirupsen/logrus"
"encoding/json"
)
type SyzStraceConfig struct {
CorpusGenConf CorpusGenConfig `json:"corpus_gen_conf"`
ParserConf ParserConfig `json:"parser_conf"`
DistillConf DistillConfig `json:"distill_conf"`
}
type CorpusGenConfig struct {
ConfigPath string `json:"workload_config"`
Tracer string
Executor string
SshKey string
SshUser string
SshPort int
GceConfig
DestinationDir string `json:"dest_dir"`
}
type DistillConfig struct {
Type string
Stats string `json:"stats"`
ImplicitDepsFile string `json:"implicit_dependencies"`
}
type ParserConfig struct {
Os string
Arch string
Type string
LocalConfig
}
type LocalConfig struct {
InputDirectory string
Files []string
Filter []string
OutputDirectory string
}
type GceConfig struct {
NumInstances int
MachineType string
ImageName string
}
func NewConfig(location string) (config *SyzStraceConfig) {
dat, fileErr := ioutil.ReadFile(location)
if fileErr != nil {
logrus.Fatalf("Unable to read config, exiting")
}
if err := json.Unmarshal(dat, &config); err != nil {
logrus.Fatalf("Unable to read config: %s", err.Error())
}
return
}