refactor conf

This commit is contained in:
Yuzuki616
2023-08-20 15:13:52 +08:00
parent 42407d5c62
commit 214324496d
19 changed files with 346 additions and 287 deletions

View File

@@ -1,27 +1,27 @@
package conf
type XrayConfig struct {
LogConfig *XrayLogConfig `yaml:"Log"`
AssetPath string `yaml:"AssetPath"`
DnsConfigPath string `yaml:"DnsConfigPath"`
RouteConfigPath string `yaml:"RouteConfigPath"`
ConnectionConfig *XrayConnectionConfig `yaml:"XrayConnectionConfig"`
InboundConfigPath string `yaml:"InboundConfigPath"`
OutboundConfigPath string `yaml:"OutboundConfigPath"`
LogConfig *XrayLogConfig `json:"Log"`
AssetPath string `json:"AssetPath"`
DnsConfigPath string `json:"DnsConfigPath"`
RouteConfigPath string `json:"RouteConfigPath"`
ConnectionConfig *XrayConnectionConfig `json:"XrayConnectionConfig"`
InboundConfigPath string `json:"InboundConfigPath"`
OutboundConfigPath string `json:"OutboundConfigPath"`
}
type XrayLogConfig struct {
Level string `yaml:"Level"`
AccessPath string `yaml:"AccessPath"`
ErrorPath string `yaml:"ErrorPath"`
Level string `json:"Level"`
AccessPath string `json:"AccessPath"`
ErrorPath string `json:"ErrorPath"`
}
type XrayConnectionConfig struct {
Handshake uint32 `yaml:"handshake"`
ConnIdle uint32 `yaml:"connIdle"`
UplinkOnly uint32 `yaml:"uplinkOnly"`
DownlinkOnly uint32 `yaml:"downlinkOnly"`
BufferSize int32 `yaml:"bufferSize"`
Handshake uint32 `json:"handshake"`
ConnIdle uint32 `json:"connIdle"`
UplinkOnly uint32 `json:"uplinkOnly"`
DownlinkOnly uint32 `json:"downlinkOnly"`
BufferSize int32 `json:"bufferSize"`
}
func NewXrayConfig() *XrayConfig {
@@ -45,3 +45,36 @@ func NewXrayConfig() *XrayConfig {
},
}
}
type XrayOptions struct {
EnableProxyProtocol bool `json:"EnableProxyProtocol"`
EnableDNS bool `json:"EnableDNS"`
DNSType string `json:"DNSType"`
EnableUot bool `json:"EnableUot"`
EnableTFO bool `json:"EnableTFO"`
DisableIVCheck bool `json:"DisableIVCheck"`
DisableSniffing bool `json:"DisableSniffing"`
EnableFallback bool `json:"EnableFallback"`
FallBackConfigs []FallBackConfigForXray `json:"FallBackConfigs"`
}
type FallBackConfigForXray struct {
SNI string `json:"SNI"`
Alpn string `json:"Alpn"`
Path string `json:"Path"`
Dest string `json:"Dest"`
ProxyProtocolVer uint64 `json:"ProxyProtocolVer"`
}
func NewXrayOptions() *XrayOptions {
return &XrayOptions{
EnableProxyProtocol: false,
EnableDNS: false,
DNSType: "AsIs",
EnableUot: false,
EnableTFO: false,
DisableIVCheck: false,
DisableSniffing: false,
EnableFallback: false,
}
}