Chore: improve code architecture
This commit is contained in:
@ -30,6 +30,7 @@ type Proxy interface {
|
||||
Name() string
|
||||
Type() AdapterType
|
||||
Generator(metadata *Metadata) (ProxyAdapter, error)
|
||||
MarshalJSON() ([]byte, error)
|
||||
}
|
||||
|
||||
// AdapterType is enum of adapter type
|
||||
|
@ -1,10 +0,0 @@
|
||||
package constant
|
||||
|
||||
type General struct {
|
||||
Mode *string `json:"mode,omitempty"`
|
||||
AllowLan *bool `json:"allow-lan,omitempty"`
|
||||
Port *int `json:"port,omitempty"`
|
||||
SocksPort *int `json:"socks-port,omitempty"`
|
||||
RedirPort *int `json:"redir-port,omitempty"`
|
||||
LogLevel *string `json:"log-level,omitempty"`
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package constant
|
||||
|
||||
var (
|
||||
// LogLevelMapping is a mapping for LogLevel enum
|
||||
LogLevelMapping = map[string]LogLevel{
|
||||
"error": ERROR,
|
||||
"warning": WARNING,
|
||||
"info": INFO,
|
||||
"debug": DEBUG,
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
ERROR LogLevel = iota
|
||||
WARNING
|
||||
INFO
|
||||
DEBUG
|
||||
)
|
||||
|
||||
type LogLevel int
|
||||
|
||||
func (l LogLevel) String() string {
|
||||
switch l {
|
||||
case INFO:
|
||||
return "info"
|
||||
case WARNING:
|
||||
return "warning"
|
||||
case ERROR:
|
||||
return "error"
|
||||
case DEBUG:
|
||||
return "debug"
|
||||
default:
|
||||
return "unknow"
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package constant
|
||||
|
||||
// ProxySignal is used to handle graceful shutdown of proxy
|
||||
type ProxySignal struct {
|
||||
Done chan<- struct{}
|
||||
Closed <-chan struct{}
|
||||
}
|
Reference in New Issue
Block a user