Documentation
¶
Index ¶
- func AdminAuth(c *gin.Context)
- func CreateRequestMap(c *gin.Context, model *APIDataModel) map[string]interface{}
- func MakeParamValuer(jsonConfig string, vars []string) map[string]Valuer
- func ProcessIP(c *gin.Context, useJSON bool)
- type APIDataModel
- type AuthResultType
- type ContextKey
- type DynamicValue
- type Endpoint
- type ID
- type IP
- type Info
- type JsTreeDataModel
- type Mockbin
- type MockbinCookie
- type RouterResult
- type Valuer
- type WsMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRequestMap ¶
func CreateRequestMap(c *gin.Context, model *APIDataModel) map[string]interface{}
Types ¶
type APIDataModel ¶
type APIDataModel struct {
ID ID `json:"id" form:"id"`
Endpoint string `json:"endpoint" form:"endpoint"`
Method string `json:"method" form:"method"`
MimeType string `json:"mimeType"`
Filename string `json:"filename"`
FileContent []byte `json:"-"`
Body string `json:"body"`
ServeFn gin.HandlerFunc `json:"-"`
// contains filtered or unexported fields
}
APIDataModel ...
func (APIDataModel) CreateJsTreeModel ¶
func (a APIDataModel) CreateJsTreeModel() JsTreeDataModel
func (APIDataModel) HandleFileDownload ¶
func (a APIDataModel) HandleFileDownload(c *gin.Context)
func (APIDataModel) HandleJSON ¶
func (a APIDataModel) HandleJSON(c *gin.Context)
func (*APIDataModel) InternalProcess ¶
func (a *APIDataModel) InternalProcess(subRouter string)
func (*APIDataModel) TryDo ¶
func (a *APIDataModel) TryDo(f func(m *APIDataModel))
type AuthResultType ¶
type AuthResultType int
const ( AuthResultIgnore AuthResultType = iota AuthResultOK AuthResultFailed )
type ContextKey ¶
type ContextKey int
ContextKey as context key type.
const RouterResultKey ContextKey = iota
RouterResultKey as RouterResult key
type DynamicValue ¶
type DynamicValue struct {
Condition string `json:"condition"`
Response json.RawMessage `json:"response"`
Status int `json:"status"`
Headers map[string]string `json:"headers"`
Expr *vm.Program
ParametersEvaluator map[string]Valuer
}
DynamicValue works for dynamic processing.
type Endpoint ¶
type Endpoint struct {
ID uint64 `name:"id" storm:"id,increment"`
Endpoint string `name:"endpoint" storm:"unique"`
Methods string `name:"methods"`
MimeType string `name:"mime_type"`
Filename string `name:"filename"`
Body string `name:"body"`
FileContent []byte `name:"file_content"`
CreateTime string `name:"create_time"`
UpdateTime string `name:"update_time"`
DeletedAt string `name:"deleted_at"`
}
Endpoint is the structure for table httplive_endpoint.
func (*Endpoint) CreateDefault ¶
func (ep *Endpoint) CreateDefault(m *APIDataModel)
func (*Endpoint) CreateDirect ¶
func (ep *Endpoint) CreateDirect(m *APIDataModel)
func (*Endpoint) CreateEcho ¶
func (ep *Endpoint) CreateEcho(m *APIDataModel)
func (*Endpoint) CreateMockbin ¶
func (ep *Endpoint) CreateMockbin(m *APIDataModel)
func (Endpoint) CreateProxy ¶
func (ep Endpoint) CreateProxy(m *APIDataModel)
type ID ¶
type ID string
ID is the ID for UnmarshalJSON from integer.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON from integer or string.
type IP ¶
type IP struct {
Country string `json:"country"`
CountryID string `json:"country_id"`
Area string `json:"area"`
AreaID string `json:"area_id"`
Region string `json:"region"`
RegionID string `json:"region_id"`
City string `json:"city"`
CityID string `json:"city_id"`
Isp string `json:"isp"`
}
IP ...
type JsTreeDataModel ¶
type JsTreeDataModel struct {
ID int `json:"id"`
Key string `json:"key"`
OriginKey string `json:"originKey"`
Text string `json:"text"`
Type string `json:"type"`
Children []JsTreeDataModel `json:"children"`
}
JsTreeDataModel ...
type Mockbin ¶
type Mockbin struct {
Status int `json:"status"`
Method string `json:"method"`
RedirectURL string `json:"redirectURL"`
Headers map[string]string `json:"headers"`
Cookies []MockbinCookie `json:"cookies"`
Close bool `json:"close"`
ContentType string `json:"contentType"`
Payload json.RawMessage `json:"payload"`
Sleep string `json:"sleep"`
}
Mockbin defines the mockbin struct.
type MockbinCookie ¶
type MockbinCookie struct {
Name string `json:"name"`
Value string `json:"value"`
MaxAge int `json:"maxAge"`
Path string `json:"path"`
Domain string `json:"domain"`
Secure bool `json:"secure"`
HTTPOnly bool `json:"httpOnly"`
SameSite string `json:"sameSite"`
}
MockbinCookie defines the cookie format.
func (MockbinCookie) SetCookie ¶
func (v MockbinCookie) SetCookie(c *gin.Context)
type RouterResult ¶
type RouterResult struct {
RouterServed bool
RouterBody []byte
Filename string
ResponseHeader map[string]string
ResponseStatus int
ResponseSize int
RemoteAddr string
}
RouterResult result for router
type WsMessage ¶
type WsMessage struct {
Time string `json:"time"`
Host string `json:"host"`
Body interface{} `json:"body"`
Response json.RawMessage `json:"response"`
ResponseStatus int `json:"status"`
ResponseHeader map[string]string `json:"responseHeader"`
ResponseSize int `json:"responseSize"`
Header map[string]string `json:"header"`
Method string `json:"method"`
Path string `json:"path"`
Query map[string]string `json:"query"`
RemoteAddr string `json:"remoteAddr"`
}
WsMessage ...
Click to show internal directories.
Click to hide internal directories.