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
}

View File

@@ -1,6 +1,6 @@
//go:build hy
package core
package imports
// not works for now
//import _ "github.com/Yuzuki616/V2bX/core/hy"

View File

@@ -1,5 +1,5 @@
//go:build xray
package core
package imports
import _ "github.com/Yuzuki616/V2bX/core/xray"

View File

@@ -4,7 +4,7 @@ import (
// The following are necessary as they register handlers in their init functions.
// Mandatory features. Can't remove unless there are replacements.
_ "github.com/xtls/xray-core/app/dispatcher"
_ "github.com/Yuzuki616/V2bX/core/xray/app/dispatcher"
_ "github.com/xtls/xray-core/app/proxyman/inbound"
_ "github.com/xtls/xray-core/app/proxyman/outbound"