Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpsertRules ¶
UpsertRules create or update http rule from user submit
Types ¶
type Record ¶
type Record struct {
Method string `gorm:"index" form:"method" json:"method"`
URI string `form:"uri" json:"uri"`
record.BaseRecord
RawRequest string `json:"raw_request" notice:"-"`
Rule Rule `gorm:"foreignKey:RuleName;references:Name;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" form:"-" json:"-" notice:"-"`
}
type Rule ¶
type Rule struct {
rule.BaseRule `yaml:",inline"`
ResponseStatusCode string `gorm:"index;default:200;not null" form:"response_status_code" json:"response_status_code" yaml:"response_status_code"`
ResponseHeaders database.MapField `form:"response_headers" json:"response_headers" yaml:"response_headers"`
ResponseBody string `gorm:"type:longtext" form:"response_body" json:"response_body" yaml:"response_body"`
}
Rule Http rule struct
func NewRule ¶
func NewRule(name, flagFormat, responseBody string, pushToClient, notice bool, responseStatus string, responseHeaders database.MapField) *Rule
NewRule new http rule struct
func (*Rule) CreateOrUpdate ¶
CreateOrUpdate creates or updates the http rule in database and ruleSet
type Server ¶
type Server struct {
Addr string
Token string
IpHeader string
Router *gin.Engine
ApiGroup *gin.RouterGroup
// contains filtered or unexported fields
}
func (*Server) SetIpHeader ¶
func (*Server) UpdateRules ¶
Click to show internal directories.
Click to hide internal directories.