mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
update
fix deps cycle update example fix color for X25519 output supported cores message
This commit is contained in:
12
core/core.go
12
core/core.go
@@ -2,6 +2,8 @@ package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/Yuzuki616/V2bX/conf"
|
||||
)
|
||||
|
||||
@@ -10,7 +12,7 @@ var (
|
||||
)
|
||||
|
||||
func NewCore(c *conf.CoreConfig) (Core, error) {
|
||||
if f, ok := cores[c.Type]; ok {
|
||||
if f, ok := cores[strings.ToLower(c.Type)]; ok {
|
||||
return f(c)
|
||||
} else {
|
||||
return nil, errors.New("unknown core type")
|
||||
@@ -20,3 +22,11 @@ func NewCore(c *conf.CoreConfig) (Core, error) {
|
||||
func RegisterCore(t string, f func(c *conf.CoreConfig) (Core, error)) {
|
||||
cores[t] = f
|
||||
}
|
||||
|
||||
func RegisteredCore() []string {
|
||||
cs := make([]string, 0, len(cores))
|
||||
for k := range cores {
|
||||
cs = append(cs, k)
|
||||
}
|
||||
return cs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user