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

@ -1,8 +1,10 @@
package cmd
import (
"github.com/spf13/cobra"
"log"
_ "github.com/Yuzuki616/V2bX/core/imports"
"github.com/spf13/cobra"
)
var command = &cobra.Command{

View File

@ -2,7 +2,9 @@ package cmd
import (
"fmt"
"strings"
vCore "github.com/Yuzuki616/V2bX/core"
"github.com/spf13/cobra"
)
@ -26,6 +28,7 @@ func init() {
func showVersion() {
fmt.Printf("%s %s (%s) \n", codename, version, intro)
fmt.Printf("Supported cores: %s\n", strings.Join(vCore.RegisteredCore(), ", "))
// Warning
fmt.Println(Warn("This version need V2board version >= 1.7.0."))
}

View File

@ -4,6 +4,7 @@ import (
"crypto/rand"
"encoding/base64"
"fmt"
"github.com/spf13/cobra"
"golang.org/x/crypto/curve25519"
)
@ -45,7 +46,7 @@ func executeX25519() {
return
}
output = Err("Private key: ",
output = fmt.Sprint("Private key: ",
base64.RawURLEncoding.EncodeToString(privateKey),
"\nPublic key: ",
base64.RawURLEncoding.EncodeToString(publicKey))

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"

View File

@ -1,17 +1,20 @@
Log:
Level: warning # Log level: none, error, warning, info, debug
AccessPath: # /etc/XrayR/access.Log
ErrorPath: # /etc/XrayR/error.log
DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.github.io/config/dns.html for help
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
ConnetionConfig:
Handshake: 4 # Handshake time limit, Second
ConnIdle: 30 # Connection idle time limit, Second
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
DownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, Second
BufferSize: 64 # The internal cache size of each connection, kB
CoreConfig:
Type: "xray" # Core type
XrayConfig:
Log:
Level: warning # Log level: none, error, warning, info, debug
AccessPath: # /etc/XrayR/access.Log
ErrorPath: # /etc/XrayR/error.log
DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.github.io/config/dns.html for help
RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help
InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help
OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help
ConnectionConfig:
Handshake: 4 # Handshake time limit, Second
ConnIdle: 30 # Connection idle time limit, Second
UplinkOnly: 2 # Time limit when the connection downstream is closed, Second
DownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, Second
BufferSize: 64 # The internal cache size of each connection, kB
Nodes:
- ApiConfig:
ApiHost: "http://127.0.0.1:667"