add run many core at the same time

This commit is contained in:
Yuzuki616
2023-06-09 21:20:41 +08:00
parent 9827d442d5
commit f07629d438
9 changed files with 142 additions and 9 deletions

View File

@@ -12,6 +12,25 @@ var (
)
func NewCore(c *conf.CoreConfig) (Core, error) {
// multi core
if types := strings.Split(c.Type, " "); len(types) > 1 {
var cs []Core
for _, t := range types {
f, ok := cores[strings.ToLower(c.Type)]
if !ok {
return nil, errors.New("unknown core type: " + t)
}
core1, err := f(c)
if err != nil {
return nil, err
}
cs = append(cs, core1)
}
return &Selecter{
cores: cs,
}, nil
}
// one core
if f, ok := cores[strings.ToLower(c.Type)]; ok {
return f(c)
} else {