add recorder for serial handler

This commit is contained in:
ginuerzh
2023-09-18 21:13:11 +08:00
parent a623232cc1
commit a743862f23
9 changed files with 188 additions and 26 deletions

View File

@ -229,6 +229,8 @@ type IngressConfig struct {
type RecorderConfig struct {
Name string `json:"name"`
File *FileRecorder `yaml:",omitempty" json:"file,omitempty"`
TCP *TCPRecorder `yaml:"tcp,omitempty" json:"tcp,omitempty"`
HTTP *HTTPRecorder `yaml:"http,omitempty" json:"http,omitempty"`
Redis *RedisRecorder `yaml:",omitempty" json:"redis,omitempty"`
Plugin *PluginConfig `yaml:",omitempty" json:"plugin,omitempty"`
}
@ -238,6 +240,16 @@ type FileRecorder struct {
Sep string `yaml:",omitempty" json:"sep,omitempty"`
}
type TCPRecorder struct {
Addr string `json:"addr"`
Timeout time.Duration `json:"timeout"`
}
type HTTPRecorder struct {
URL string `json:"url" yaml:"url"`
Timeout time.Duration `json:"timeout"`
}
type RedisRecorder struct {
Addr string `json:"addr"`
DB int `yaml:",omitempty" json:"db,omitempty"`
@ -247,8 +259,9 @@ type RedisRecorder struct {
}
type RecorderObject struct {
Name string `json:"name"`
Record string `json:"record"`
Name string `json:"name"`
Record string `json:"record"`
Metadata map[string]any
}
type LimiterConfig struct {