Documentation ¶
Index ¶
- Variables
- func API404Response(ctx *gin.Context, err error)
- func API409Response(ctx *gin.Context, err error)
- func API500Response(ctx *gin.Context, err error)
- func APIResponse(ctx *gin.Context, err error, data interface{})
- func Auth403Failed(ctx *gin.Context, msg *Errno, data interface{})
- func AuthFailed(ctx *gin.Context, msg *Errno, data interface{})
- func BacthMissionFailedResponse(ctx *gin.Context, err ...error)
- func BacthMissionSuccessResponse(ctx *gin.Context, err error)
- func ConnectDbusService(ctx *gin.Context, err error)
- func DecodeErr(err error) (int, string)
- func DecodeErrSlice(err ...error) (int, []string)
- func NotFount(ctx *gin.Context, err error, data interface{})
- func SuccessResponse(ctx *gin.Context, err error, data interface{})
- type AsyncHostQuery
- type BatchPortQuery
- type BatchServiceQuery
- type BatchSettingQuery
- type BatchZoneQuery
- type Err
- type Errno
- type ForwardQuery
- type HostQuery
- type IDQuery
- type InfoQuery
- type InfoResp
- type ListHostQuery
- type ListQuery
- type ListTagQuery
- type PortEditQuery
- type PortQuery
- type Query
- type RemoveQuery
- type Response
- type ResponseSlice
- type RichEditQuery
- type RichQuery
- type ServiceQuery
- type ServiceSettingQuery
- type TagEditQuery
- type TemplateEditQuery
- type TokenEditQuery
- type UserQuery
- type UserResp
- type ZoneDst
- type ZoneSettingQuery
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Common errors OK = &Errno{Code: 10000, Message: "operation succeeded"} QUERY_NULL = &Errno{Code: 10003, Message: "request query is null"} NETWORK_MASQUERADE_ENABLE = &Errno{Code: 10000, Message: "network masquerade is enable"} NETWORK_MASQUERADE_DISABLE = &Errno{Code: 10000, Message: "network masquerade is disable"} ErrDBus = "connect to remote firewalld server failed" InternalServerError = &Errno{Code: 10001, Message: "Internal server error"} ErrBind = &Errno{Code: 10002, Message: "Error occurred while binding the request body to the struct"} ErrParam = &Errno{Code: 10003, Message: "参数有误"} ErrSignParam = &Errno{Code: 10004, Message: "签名参数有误"} ErrValidation = &Errno{Code: 20001, Message: "Validation failed"} ErrDatabase = &Errno{Code: 20002, Message: "Database error"} ErrToken = &Errno{Code: 20003, Message: "Error occurred while signing the JSON web token"} ErrInvalidTransaction = &Errno{Code: 20004, Message: "invalid transaction"} // NOTFOUNT ErrRichNotFount = &Errno{Code: 40004, Message: "The rich rules in the zone is empty"} ErrServiceNotFount = &Errno{Code: 40004, Message: "The service in the zone is empty"} ErrPortNotFount = &Errno{Code: 40004, Message: "The port in the zone is empty"} ErrZoneNotFount = &Errno{Code: 40004, Message: "Not found the zone"} ErrForwardNotFount = &Errno{Code: 40004, Message: "The Forward in the zone is empty"} // token errors ErrEncrypt = &Errno{Code: 50101, Message: "success"} ErrUserNotFound = &Errno{Code: 50102, Message: "User not found"} ErrTokenInvalid = &Errno{Code: 50103, Message: "Invalied token"} ErrPasswordIncorrect = &Errno{Code: 50104, Message: "Incorrect username or password"} ErrUserExist = &Errno{Code: 50105, Message: "User exists"} ErrUserNotExist = &Errno{Code: 50106, Message: "User does not exist"} ErrNeedAuth = &Errno{Code: 50107, Message: "Your need authetication"} ErrTokenDestoryed = &Errno{Code: 50108, Message: "Token is destoryed"} ErrSendSMSTooMany = &Errno{Code: 50109, Message: "已超出当日限制,请明天再试"} ErrVerifyCode = &Errno{Code: 50110, Message: "验证码错误"} ErrEmailOrPassword = &Errno{Code: 50111, Message: "邮箱或密码错误"} ErrTwicePasswordNotMatch = &Errno{Code: 50112, Message: "两次密码输入不一致"} ErrRegisterFailed = &Errno{Code: 50113, Message: "注册失败"} ErrCreatedUser = &Errno{Code: 50114, Message: "用户创建失败"} ErrDashboardFailed = &Errno{Code: 50115, Message: "Get host status failed"} ErrTagNotFound = &Errno{Code: 30104, Message: "Tag not found"} ErrTagExist = &Errno{Code: 30106, Message: "Tag does existed"} ErrTemplateExist = &Errno{Code: 30106, Message: "Template does existed"} ErrExist = &Errno{Code: 30106, Message: "Tag does existed"} BatchSuccessCreated = &Errno{Code: 60000, Message: "The batch mission has created"} BatchErrCreated = &Errno{Code: 60005, Message: "The batch mission create failed"} )
nolint: golint
Functions ¶
func APIResponse ¶ added in v0.0.3
APIResponse ....
func Auth403Failed ¶ added in v0.0.3
API403Response ....
func AuthFailed ¶ added in v0.0.3
func BacthMissionFailedResponse ¶ added in v0.0.3
ConnectDbusService ....
func BacthMissionSuccessResponse ¶ added in v0.0.3
ConnectDbusService ....
func ConnectDbusService ¶ added in v0.0.3
ConnectDbusService ....
func DecodeErrSlice ¶
func SuccessResponse ¶ added in v0.0.3
SuccessResponse ....
Types ¶
type AsyncHostQuery ¶ added in v0.0.3
type BatchPortQuery ¶ added in v0.0.3
type BatchServiceQuery ¶ added in v0.0.3
type BatchServiceQuery struct { Delay uint32 `form:"delay,default=0" json:"delay,omitempty"` Services []ServiceQuery `form:"services" json:"services,omitempty"` }
type BatchSettingQuery ¶ added in v0.0.3
type BatchZoneQuery ¶ added in v0.0.3
type ForwardQuery ¶ added in v0.0.3
type ForwardQuery struct { Ip string `form:"ip" json:"ip" binding:"required"` Zone string `form:"zone,default=public" json:"zone"` Timeout uint32 `form:"timeout,default=0" json:"timeout"` Forward *apis.ForwardPort `form:"forward" json:"forward,omitempty" binding:"required"` }
type HostQuery ¶ added in v0.0.3
type HostQuery struct { IP string `form:"ip" json:"ip,omitempty" binding:"required"` TagId int `form:"tag_id" json:"tag_id" binding:"required"` Hostname string `form:"hostname" json:"hostname" ` ID int `form:"id" json:"id" binding:"omitempty"` Limit uint16 `form:"limit,default=100" json:"limit"` Offset uint16 `form:"offset,default=0" json:"offset"` }
type IDQuery ¶ added in v0.0.3
type IDQuery struct {
ID uint64 `form:"id" json:"id,omitempty" binding:"required"`
}
type InfoQuery ¶ added in v0.0.3
type InfoQuery struct {
Token string `form:"token" json:"token" binding:"required"`
}
type ListHostQuery ¶ added in v0.0.3
type ListTagQuery ¶ added in v0.0.3
type PortEditQuery ¶ added in v0.0.3
type Query ¶ added in v0.0.3
type Query struct { Ip string `form:"ip" json:"ip" binding:"required"` Zone string `form:"zone,default=public" json:"zone"` Timeout uint32 `form:"timeout,default=0" json:"timeout"` Port *apis.Port `form:"port" json:"port,omitempty"` Forward *apis.ForwardPort `form:"forward" json:"forward,omitempty"` Rich *apis.Rule `form:"rich" json:"rich,omitempty"` Service string `form:"service" json:"service,omitempty"` }
type RemoveQuery ¶ added in v0.0.3
type ResponseSlice ¶ added in v0.0.3
type RichEditQuery ¶ added in v0.0.3
type RichEditQuery struct { Family string `form:"family" json:"family,omitempty" binding:"omitempty"` Source string `form:"source" json:"source,omitempty" binding:"omitempty"` Destination string `form:"destination" json:"destination,omitempty" binding:"omitempty"` Port []string `form:"port" json:"port,omitempty" binding:"omitempty"` Protocol string `form:"protocol" json:"protocol,omitempty" binding:"omitempty"` Action string `form:"action" json:"action,omitempty" binding:"required"` Limit uint16 `form:"limit" json:"limit,omitempty" binding:"omitempty"` LimitUnit string `form:"limit_unit" json:"limit_unit,omitempty" binding:"omitempty"` TemplateId int `form:"template_id" json:"template_id" binding:"required"` ID uint64 `form:"id" json:"id,omitempty" binding:"omitempty"` }
type ServiceQuery ¶ added in v0.0.3
type ServiceSettingQuery ¶ added in v0.0.3
type ServiceSettingQuery struct { Host string `form:"host" json:"host" binding:"required"` ServiceName string `form:"service_name" json:"service_name" binding:"required"` Setting *apis.ServiceSetting `form:"setting" json:"setting,omitempty" binding:"required"` }
type TagEditQuery ¶ added in v0.0.3
type TemplateEditQuery ¶ added in v0.0.3
type TokenEditQuery ¶ added in v0.0.3
type UserResp ¶ added in v0.0.3
type UserResp struct { UserID uint64 `form:"user_id" json:"user_id,omitempty" binding:"required"` Username string `form:"username" json:"username,omitempty" binding:"required"` Token string `form:"token" json:"token,omitempty" binding:"required"` Name string `form:"name" json:"name,omitempty" binding:"required"` LoginIP string `form:"login_ip" json:"login_ip,omitempty"` }
type ZoneSettingQuery ¶ added in v0.0.3
type ZoneSettingQuery struct { Ip string `form:"ip" json:"ip" binding:"required"` Setting *apis.QuerySettings `form:"setting" json:"Setting,omitempty" binding:"required"` }
Click to show internal directories.
Click to hide internal directories.