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,15 +1,15 @@
package conf
type SingConfig struct {
LogConfig SingLogConfig `yaml:"LogConfig"`
OriginalPath string `yaml:"OriginalPath"`
LogConfig SingLogConfig `json:"Log"`
OriginalPath string `json:"OriginalPath"`
}
type SingLogConfig struct {
Disabled bool `yaml:"Disable"`
Level string `yaml:"Level"`
Output string `yaml:"Output"`
Timestamp bool `yaml:"Timestamp"`
Disabled bool `json:"Disable"`
Level string `json:"Level"`
Output string `json:"Output"`
Timestamp bool `json:"Timestamp"`
}
func NewSingConfig() *SingConfig {
@@ -20,3 +20,32 @@ func NewSingConfig() *SingConfig {
},
}
}
type SingOptions struct {
EnableProxyProtocol bool `json:"EnableProxyProtocol"`
TCPFastOpen bool `json:"EnableTFO"`
SniffEnabled bool `json:"EnableSniff"`
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
}
type FallBackConfigForSing struct {
// sing-box
FallBack FallBack `json:"FallBack"`
FallBackForALPN map[string]FallBack `json:"FallBackForALPN"`
}
type FallBack struct {
Server string `json:"Server"`
ServerPort string `json:"ServerPort"`
}
func NewSingOptions() *SingOptions {
return &SingOptions{
EnableProxyProtocol: false,
TCPFastOpen: false,
SniffEnabled: true,
SniffOverrideDestination: true,
FallBackConfigs: &FallBackConfigForSing{},
}
}