package basic
type Target struct {
Ip string `yaml:"ip,omitempty"`
Domain string `yaml:"domain,omitempty"`
Node string `yaml:"node,omitempty"`
Port int `yaml:"port"`
}
type Strategy string
const (
StrategyRandom Strategy = "random"
StrategySerial Strategy = "serial"
StrategyFastest Strategy = "fastest"
)
type DetectMethod string
const (
DetectMagic DetectMethod = "magic"
DetectPrefix DetectMethod = "prefix"
DetectRegex DetectMethod = "regex"
DetectFallback DetectMethod = "fallback"
)
type Detect struct {
Method DetectMethod `yaml:"method"`
Pattern string `yaml:"pattern"`
}
type Forward struct {
Strategy Strategy `yaml:"strategy"`
Targets []Target `yaml:"targets"`
Fallbacks []Target `yaml:"fallbacks,omitempty"`
}
type TcpDestination struct {
Type string `yaml:"type"` Forward *Forward `yaml:"forward,omitempty"`
}
type TcpProtocolRule struct {
Name string `yaml:"name"`
Priority int `yaml:"priority"`
Detect Detect `yaml:"detect"`
Destination TcpDestination `yaml:"destination"`
}
type LegacyTcpConfig struct {
Protocols []TcpProtocolRule `yaml:"protocols"`
}
type UdpDestination struct {
Type string `yaml:"type"`
Forward *Forward `yaml:"forward,omitempty"`
}
type UdpProtocolRule struct {
Name string `yaml:"name"`
Priority int `yaml:"priority"`
Detect Detect `yaml:"detect"`
Destination UdpDestination `yaml:"destination"`
}
type LegacyUdpConfig struct {
Protocols []UdpProtocolRule `yaml:"protocols"`
}