mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 12:40:11 +00:00
update conf, fix tcp count
This commit is contained in:
34
conf/conf.go
34
conf/conf.go
@@ -10,13 +10,13 @@ import (
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
LogConfig *LogConfig `yaml:"Log"`
|
||||
DnsConfigPath string `yaml:"DnsConfigPath"`
|
||||
InboundConfigPath string `yaml:"InboundConfigPath"`
|
||||
OutboundConfigPath string `yaml:"OutboundConfigPath"`
|
||||
RouteConfigPath string `yaml:"RouteConfigPath"`
|
||||
ConnectionConfig *ConnetionConfig `yaml:"ConnectionConfig"`
|
||||
NodesConfig []*NodeConfig `yaml:"Nodes"`
|
||||
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"`
|
||||
}
|
||||
|
||||
func New() *Conf {
|
||||
@@ -26,7 +26,7 @@ func New() *Conf {
|
||||
InboundConfigPath: "",
|
||||
OutboundConfigPath: "",
|
||||
RouteConfigPath: "",
|
||||
ConnectionConfig: NewConnetionConfig(),
|
||||
ConnectionConfig: NewConnectionConfig(),
|
||||
NodesConfig: []*NodeConfig{},
|
||||
}
|
||||
}
|
||||
@@ -55,17 +55,15 @@ func (p *Conf) Watch(filePath string, reload func()) error {
|
||||
defer watcher.Close()
|
||||
for {
|
||||
select {
|
||||
case event := <-watcher.Events:
|
||||
if event.Has(fsnotify.Write) {
|
||||
log.Println("config dir changed, reloading...")
|
||||
*p = *New()
|
||||
err := p.LoadFromPath(filePath)
|
||||
if err != nil {
|
||||
log.Printf("reload config error: %s", err)
|
||||
}
|
||||
log.Println("reload config success")
|
||||
reload()
|
||||
case <-watcher.Events:
|
||||
log.Println("config dir changed, reloading...")
|
||||
*p = *New()
|
||||
err := p.LoadFromPath(filePath)
|
||||
if err != nil {
|
||||
log.Printf("reload config error: %s", err)
|
||||
}
|
||||
reload()
|
||||
log.Println("reload config success")
|
||||
case err := <-watcher.Errors:
|
||||
if err != nil {
|
||||
log.Printf("File watcher error: %s", err)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package conf
|
||||
|
||||
type ConnetionConfig struct {
|
||||
type ConnectionConfig struct {
|
||||
Handshake uint32 `yaml:"handshake"`
|
||||
ConnIdle uint32 `yaml:"connIdle"`
|
||||
UplinkOnly uint32 `yaml:"uplinkOnly"`
|
||||
@@ -8,8 +8,8 @@ type ConnetionConfig struct {
|
||||
BufferSize int32 `yaml:"bufferSize"`
|
||||
}
|
||||
|
||||
func NewConnetionConfig() *ConnetionConfig {
|
||||
return &ConnetionConfig{
|
||||
func NewConnectionConfig() *ConnectionConfig {
|
||||
return &ConnectionConfig{
|
||||
Handshake: 4,
|
||||
ConnIdle: 30,
|
||||
UplinkOnly: 2,
|
||||
|
||||
30
conf/node.go
30
conf/node.go
@@ -15,21 +15,21 @@ type ApiConfig struct {
|
||||
}
|
||||
|
||||
type ControllerConfig struct {
|
||||
ListenIP string `yaml:"ListenIP"`
|
||||
SendIP string `yaml:"SendIP"`
|
||||
EnableDNS bool `yaml:"EnableDNS"`
|
||||
DNSType string `yaml:"DNSType"`
|
||||
EnableVless bool `yaml:"EnableVless"`
|
||||
EnableTls bool `yaml:"EnableTls"`
|
||||
LimitConfig LimitConfig `yaml:"LimitConfig"`
|
||||
DisableUploadTraffic bool `yaml:"DisableUploadTraffic"`
|
||||
DisableGetRule bool `yaml:"DisableGetRule"`
|
||||
EnableProxyProtocol bool `yaml:"EnableProxyProtocol"`
|
||||
EnableFallback bool `yaml:"EnableFallback"`
|
||||
DisableIVCheck bool `yaml:"DisableIVCheck"`
|
||||
DisableSniffing bool `yaml:"DisableSniffing"`
|
||||
FallBackConfigs []*FallBackConfig `yaml:"FallBackConfigs"`
|
||||
CertConfig *CertConfig `yaml:"CertConfig"`
|
||||
ListenIP string `yaml:"ListenIP"`
|
||||
SendIP string `yaml:"SendIP"`
|
||||
EnableDNS bool `yaml:"EnableDNS"`
|
||||
DNSType string `yaml:"DNSType"`
|
||||
EnableVless bool `yaml:"EnableVless"`
|
||||
EnableTls bool `yaml:"EnableTls"`
|
||||
LimitConfig LimitConfig `yaml:"LimitConfig"`
|
||||
DisableUploadTraffic bool `yaml:"DisableUploadTraffic"`
|
||||
DisableGetRule bool `yaml:"DisableGetRule"`
|
||||
EnableProxyProtocol bool `yaml:"EnableProxyProtocol"`
|
||||
EnableFallback bool `yaml:"EnableFallback"`
|
||||
DisableIVCheck bool `yaml:"DisableIVCheck"`
|
||||
DisableSniffing bool `yaml:"DisableSniffing"`
|
||||
FallBackConfigs []FallBackConfig `yaml:"FallBackConfigs"`
|
||||
CertConfig *CertConfig `yaml:"CertConfig"`
|
||||
}
|
||||
|
||||
type LimitConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user