fix deps cycle
update example
fix color for X25519
output supported cores message
This commit is contained in:
Yuzuki616
2023-06-08 03:11:42 +08:00
parent 0958e351f0
commit ca67855ec9
8 changed files with 39 additions and 20 deletions

View File

@@ -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
}