mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
update
add conditional compilation support add multi core support
This commit is contained in:
33
conf/conf.go
33
conf/conf.go
@@ -2,34 +2,35 @@ package conf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"gopkg.in/yaml.v3"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
LogConfig *LogConfig `yaml:"Log"`
|
||||
DnsConfigPath string `yaml:"DnsConfigPath"`
|
||||
InboundConfigPath string `yaml:"InboundConfigPath"`
|
||||
OutboundConfigPath string `yaml:"OutboundConfigPath"`
|
||||
RouteConfigPath string `yaml:"RouteConfigPath"`
|
||||
ConnectionConfig *ConnectionConfig `yaml:"ConnectionConfig"`
|
||||
NodesConfig []*NodeConfig `yaml:"Nodes"`
|
||||
CoreConfig CoreConfig `yaml:"CoreConfig"`
|
||||
NodesConfig []*NodeConfig `yaml:"Nodes"`
|
||||
}
|
||||
|
||||
func New() *Conf {
|
||||
return &Conf{
|
||||
LogConfig: NewLogConfig(),
|
||||
DnsConfigPath: "",
|
||||
InboundConfigPath: "",
|
||||
OutboundConfigPath: "",
|
||||
RouteConfigPath: "",
|
||||
ConnectionConfig: NewConnectionConfig(),
|
||||
NodesConfig: []*NodeConfig{},
|
||||
CoreConfig: CoreConfig{
|
||||
Type: "xray",
|
||||
XrayConfig: &XrayConfig{
|
||||
LogConfig: NewLogConfig(),
|
||||
DnsConfigPath: "",
|
||||
InboundConfigPath: "",
|
||||
OutboundConfigPath: "",
|
||||
RouteConfigPath: "",
|
||||
ConnectionConfig: NewConnectionConfig(),
|
||||
},
|
||||
},
|
||||
NodesConfig: []*NodeConfig{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package conf
|
||||
|
||||
type ConnectionConfig struct {
|
||||
Handshake uint32 `yaml:"handshake"`
|
||||
ConnIdle uint32 `yaml:"connIdle"`
|
||||
UplinkOnly uint32 `yaml:"uplinkOnly"`
|
||||
DownlinkOnly uint32 `yaml:"downlinkOnly"`
|
||||
BufferSize int32 `yaml:"bufferSize"`
|
||||
}
|
||||
|
||||
func NewConnectionConfig() *ConnectionConfig {
|
||||
return &ConnectionConfig{
|
||||
Handshake: 4,
|
||||
ConnIdle: 30,
|
||||
UplinkOnly: 2,
|
||||
DownlinkOnly: 4,
|
||||
BufferSize: 64,
|
||||
}
|
||||
}
|
||||
33
conf/core.go
Normal file
33
conf/core.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package conf
|
||||
|
||||
type CoreConfig struct {
|
||||
Type string `yaml:"Type"`
|
||||
XrayConfig *XrayConfig `yaml:"Xray"`
|
||||
}
|
||||
|
||||
type XrayConfig struct {
|
||||
LogConfig *LogConfig `yaml:"Log"`
|
||||
DnsConfigPath string `yaml:"DnsConfigPath"`
|
||||
RouteConfigPath string `yaml:"RouteConfigPath"`
|
||||
ConnectionConfig *ConnectionConfig `yaml:"ConnectionConfig"`
|
||||
InboundConfigPath string `yaml:"InboundConfigPath"`
|
||||
OutboundConfigPath string `yaml:"OutboundConfigPath"`
|
||||
}
|
||||
|
||||
type ConnectionConfig struct {
|
||||
Handshake uint32 `yaml:"handshake"`
|
||||
ConnIdle uint32 `yaml:"connIdle"`
|
||||
UplinkOnly uint32 `yaml:"uplinkOnly"`
|
||||
DownlinkOnly uint32 `yaml:"downlinkOnly"`
|
||||
BufferSize int32 `yaml:"bufferSize"`
|
||||
}
|
||||
|
||||
func NewConnectionConfig() *ConnectionConfig {
|
||||
return &ConnectionConfig{
|
||||
Handshake: 4,
|
||||
ConnIdle: 30,
|
||||
UplinkOnly: 2,
|
||||
DownlinkOnly: 4,
|
||||
BufferSize: 64,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user