mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-05 05:00:08 +00:00
support custom core name
This commit is contained in:
17
core/core.go
17
core/core.go
@@ -2,7 +2,6 @@ package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/InazumaV/V2bX/conf"
|
||||
)
|
||||
@@ -17,21 +16,7 @@ func NewCore(c []conf.CoreConfig) (Core, error) {
|
||||
}
|
||||
// multi core
|
||||
if len(c) > 1 {
|
||||
var cs []Core
|
||||
for _, t := range c {
|
||||
f, ok := cores[strings.ToLower(t.Type)]
|
||||
if !ok {
|
||||
return nil, errors.New("unknown core type: " + t.Type)
|
||||
}
|
||||
core1, err := f(&t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs = append(cs, core1)
|
||||
}
|
||||
return &Selector{
|
||||
cores: cs,
|
||||
}, nil
|
||||
return NewSelector(c)
|
||||
}
|
||||
// one core
|
||||
if f, ok := cores[c[0].Type]; ok {
|
||||
|
||||
Reference in New Issue
Block a user