mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
change project structure
add across nodes ip limit add user ip recorder del config file watch
This commit is contained in:
23
conf/conf.go
Normal file
23
conf/conf.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package conf
|
||||
|
||||
type Conf struct {
|
||||
LogConfig *LogConfig `mapstructure:"Log"`
|
||||
DnsConfigPath string `mapstructure:"DnsConfigPath"`
|
||||
InboundConfigPath string `mapstructure:"InboundConfigPath"`
|
||||
OutboundConfigPath string `mapstructure:"OutboundConfigPath"`
|
||||
RouteConfigPath string `mapstructure:"RouteConfigPath"`
|
||||
ConnectionConfig *ConnetionConfig `mapstructure:"ConnectionConfig"`
|
||||
NodesConfig []*NodeConfig `mapstructure:"Nodes"`
|
||||
}
|
||||
|
||||
func New() *Conf {
|
||||
return &Conf{
|
||||
LogConfig: NewLogConfig(),
|
||||
DnsConfigPath: "",
|
||||
InboundConfigPath: "",
|
||||
OutboundConfigPath: "",
|
||||
RouteConfigPath: "",
|
||||
ConnectionConfig: NewConnetionConfig(),
|
||||
NodesConfig: []*NodeConfig{},
|
||||
}
|
||||
}
|
||||
19
conf/connetion.go
Normal file
19
conf/connetion.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package conf
|
||||
|
||||
type ConnetionConfig struct {
|
||||
Handshake uint32 `mapstructure:"handshake"`
|
||||
ConnIdle uint32 `mapstructure:"connIdle"`
|
||||
UplinkOnly uint32 `mapstructure:"uplinkOnly"`
|
||||
DownlinkOnly uint32 `mapstructure:"downlinkOnly"`
|
||||
BufferSize int32 `mapstructure:"bufferSize"`
|
||||
}
|
||||
|
||||
func NewConnetionConfig() *ConnetionConfig {
|
||||
return &ConnetionConfig{
|
||||
Handshake: 4,
|
||||
ConnIdle: 30,
|
||||
UplinkOnly: 2,
|
||||
DownlinkOnly: 4,
|
||||
BufferSize: 64,
|
||||
}
|
||||
}
|
||||
15
conf/log.go
Normal file
15
conf/log.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package conf
|
||||
|
||||
type LogConfig struct {
|
||||
Level string `mapstructure:"Level"`
|
||||
AccessPath string `mapstructure:"AccessPath"`
|
||||
ErrorPath string `mapstructure:"ErrorPath"`
|
||||
}
|
||||
|
||||
func NewLogConfig() *LogConfig {
|
||||
return &LogConfig{
|
||||
Level: "none",
|
||||
AccessPath: "",
|
||||
ErrorPath: "",
|
||||
}
|
||||
}
|
||||
66
conf/node.go
Normal file
66
conf/node.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package conf
|
||||
|
||||
type CertConfig struct {
|
||||
CertMode string `mapstructure:"CertMode"` // none, file, http, dns
|
||||
RejectUnknownSni bool `mapstructure:"RejectUnknownSni"`
|
||||
CertDomain string `mapstructure:"CertDomain"`
|
||||
CertFile string `mapstructure:"CertFile"`
|
||||
KeyFile string `mapstructure:"KeyFile"`
|
||||
Provider string `mapstructure:"Provider"` // alidns, cloudflare, gandi, godaddy....
|
||||
Email string `mapstructure:"Email"`
|
||||
DNSEnv map[string]string `mapstructure:"DNSEnv"`
|
||||
}
|
||||
|
||||
type FallBackConfig struct {
|
||||
SNI string `mapstructure:"SNI"`
|
||||
Alpn string `mapstructure:"Alpn"`
|
||||
Path string `mapstructure:"Path"`
|
||||
Dest string `mapstructure:"Dest"`
|
||||
ProxyProtocolVer uint64 `mapstructure:"ProxyProtocolVer"`
|
||||
}
|
||||
|
||||
type IpReportConfig struct {
|
||||
Url string `mapstructure:"Url"`
|
||||
Token string `mapstructure:"Token"`
|
||||
Periodic int `mapstructure:"Periodic"`
|
||||
Timeout int `mapstructure:"Timeout"`
|
||||
EnableIpSync bool `mapstructure:"EnableIpSync"`
|
||||
}
|
||||
|
||||
type ControllerConfig struct {
|
||||
ListenIP string `mapstructure:"ListenIP"`
|
||||
SendIP string `mapstructure:"SendIP"`
|
||||
UpdatePeriodic int `mapstructure:"UpdatePeriodic"`
|
||||
EnableDNS bool `mapstructure:"EnableDNS"`
|
||||
DNSType string `mapstructure:"DNSType"`
|
||||
DisableUploadTraffic bool `mapstructure:"DisableUploadTraffic"`
|
||||
DisableGetRule bool `mapstructure:"DisableGetRule"`
|
||||
EnableProxyProtocol bool `mapstructure:"EnableProxyProtocol"`
|
||||
EnableFallback bool `mapstructure:"EnableFallback"`
|
||||
DisableIVCheck bool `mapstructure:"DisableIVCheck"`
|
||||
DisableSniffing bool `mapstructure:"DisableSniffing"`
|
||||
FallBackConfigs []*FallBackConfig `mapstructure:"FallBackConfigs"`
|
||||
EnableIpRecorder bool `mapstructure:"EnableIpRecorder"`
|
||||
IpRecorderConfig *IpReportConfig `mapstructure:"IpRecorderConfig"`
|
||||
CertConfig *CertConfig `mapstructure:"CertConfig"`
|
||||
}
|
||||
|
||||
type ApiConfig struct {
|
||||
APIHost string `mapstructure:"ApiHost"`
|
||||
NodeID int `mapstructure:"NodeID"`
|
||||
Key string `mapstructure:"ApiKey"`
|
||||
NodeType string `mapstructure:"NodeType"`
|
||||
EnableVless bool `mapstructure:"EnableVless"`
|
||||
EnableXTLS bool `mapstructure:"EnableXTLS"`
|
||||
//EnableSS2022 bool `mapstructure:"EnableSS2022"`
|
||||
Timeout int `mapstructure:"Timeout"`
|
||||
SpeedLimit float64 `mapstructure:"SpeedLimit"`
|
||||
DeviceLimit int `mapstructure:"DeviceLimit"`
|
||||
RuleListPath string `mapstructure:"RuleListPath"`
|
||||
DisableCustomConfig bool `mapstructure:"DisableCustomConfig"`
|
||||
}
|
||||
|
||||
type NodeConfig struct {
|
||||
ApiConfig *ApiConfig `mapstructure:"ApiConfig"`
|
||||
ControllerConfig *ControllerConfig `mapstructure:"ControllerConfig"`
|
||||
}
|
||||
Reference in New Issue
Block a user