V2bX/conf/sing.go

72 lines
1.9 KiB
Go
Raw Normal View History

2023-07-29 06:47:47 -04:00
package conf
2023-08-28 03:24:28 -04:00
import (
2023-10-26 01:06:43 -04:00
"github.com/sagernet/sing-box/option"
2023-08-28 03:24:28 -04:00
)
2023-07-29 06:47:47 -04:00
type SingConfig struct {
2023-10-13 03:32:06 -04:00
LogConfig SingLogConfig `json:"Log"`
NtpConfig SingNtpConfig `json:"NTP"`
EnableConnClear bool `json:"EnableConnClear"`
OriginalPath string `json:"OriginalPath"`
2023-07-29 06:47:47 -04:00
}
type SingLogConfig struct {
2023-08-20 03:13:52 -04:00
Disabled bool `json:"Disable"`
Level string `json:"Level"`
Output string `json:"Output"`
Timestamp bool `json:"Timestamp"`
2023-07-29 06:47:47 -04:00
}
func NewSingConfig() *SingConfig {
return &SingConfig{
LogConfig: SingLogConfig{
Level: "error",
Timestamp: true,
},
2023-08-25 23:38:18 -04:00
NtpConfig: SingNtpConfig{
Enable: false,
Server: "time.apple.com",
ServerPort: 0,
},
2023-07-29 06:47:47 -04:00
}
}
2023-08-20 03:13:52 -04:00
type SingOptions struct {
EnableProxyProtocol bool `json:"EnableProxyProtocol"`
TCPFastOpen bool `json:"EnableTFO"`
SniffEnabled bool `json:"EnableSniff"`
2023-09-21 00:34:03 -04:00
EnableDNS bool `json:"EnableDNS"`
2023-08-28 03:24:28 -04:00
DomainStrategy option.DomainStrategy `json:"DomainStrategy"`
2023-08-20 03:13:52 -04:00
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
}
2023-08-25 23:38:18 -04:00
type SingNtpConfig struct {
Enable bool `json:"Enable"`
Server string `json:"Server"`
ServerPort uint16 `json:"ServerPort"`
}
2023-08-20 03:13:52 -04:00
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{
2023-09-21 00:34:03 -04:00
EnableDNS: false,
2023-08-20 03:13:52 -04:00
EnableProxyProtocol: false,
TCPFastOpen: false,
SniffEnabled: true,
SniffOverrideDestination: true,
FallBackConfigs: &FallBackConfigForSing{},
}
}