1Panel/backend/app/dto/nginx.go

76 lines
1.8 KiB
Go
Raw Normal View History

2022-11-07 16:19:05 +08:00
package dto
import "github.com/1Panel-dev/1Panel/backend/utils/nginx/components"
type NginxConfig struct {
FilePath string `json:"filePath"`
ContainerName string `json:"containerName"`
Config *components.Config `json:"config"`
OldContent string `json:"oldContent"`
}
type NginxConfigReq struct {
2022-11-24 10:28:39 +08:00
Scope NginxKey `json:"scope"`
2022-11-08 15:42:31 +08:00
Operate NginxOp `json:"operate"`
2022-11-24 10:28:39 +08:00
WebSiteID uint `json:"webSiteId"`
2022-11-08 15:42:31 +08:00
Params interface{} `json:"params"`
2022-11-07 16:19:05 +08:00
}
2022-11-24 10:28:39 +08:00
type NginxScopeReq struct {
Scope NginxKey `json:"scope"`
}
2022-11-24 16:06:18 +08:00
type NginxStatus struct {
Active string `json:"active"`
Accepts string `json:"accepts"`
Handled string `json:"handled"`
Requests string `json:"requests"`
Reading string `json:"reading"`
Writing string `json:"writing"`
Waiting string `json:"waiting"`
}
2022-11-24 10:28:39 +08:00
type NginxKey string
2022-11-07 16:19:05 +08:00
const (
2022-11-24 10:28:39 +08:00
Index NginxKey = "index"
LimitConn NginxKey = "limit-conn"
SSL NginxKey = "ssl"
HttpPer NginxKey = "http-per"
2022-11-08 15:42:31 +08:00
)
type NginxOp string
const (
ConfigNew NginxOp = "add"
ConfigUpdate NginxOp = "update"
ConfigDel NginxOp = "delete"
2022-11-07 16:19:05 +08:00
)
2022-11-24 10:28:39 +08:00
var ScopeKeyMap = map[NginxKey][]string{
2022-11-08 15:42:31 +08:00
Index: {"index"},
LimitConn: {"limit_conn", "limit_rate", "limit_conn_zone"},
2022-11-16 10:31:35 +08:00
SSL: {"ssl_certificate", "ssl_certificate_key"},
2022-11-24 10:28:39 +08:00
HttpPer: {"server_names_hash_bucket_size", "client_header_buffer_size", "client_max_body_size", "keepalive_timeout", "gzip", "gzip_min_length", "gzip_comp_level"},
2022-11-08 15:42:31 +08:00
}
2022-11-24 10:28:39 +08:00
type NginxScope string
const (
NginxHttp NginxScope = "http"
NginxServer NginxScope = "server"
NginxEvents NginxScope = "events"
)
2022-11-08 15:42:31 +08:00
var RepeatKeys = map[string]struct {
}{
"limit_conn": {},
"limit_conn_zone": {},
}
type NginxParam struct {
2022-11-24 10:28:39 +08:00
Name string `json:"name"`
SecondKey string `json:"secondKey"`
Params []string `json:"params"`
2022-11-07 16:19:05 +08:00
}