model

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PLUGIN_POSITION_HIDDEN      PluginPosition = "hidden"      //隐藏形式
	PLUGIN_POSITION_NORMAL      PluginPosition = "normal"      //文档流动形式向下展示
	PLUGIN_POSITION_AUTH        PluginPosition = "auth"        //下拉选择认证类型
	PLUGIN_POSITION_LOADBALANCE PluginPosition = "loadbalance" //下拉选择负载类型

	PLUGIN_FIELD_TYPE_INPUT    PluginFieldType = "input"    //文字
	PLUGIN_FIELD_TYPE_TEXTAREA PluginFieldType = "textarea" //文本域
	PLUGIN_FIELD_TYPE_RADIO    PluginFieldType = "radio"    //单选
	PLUGIN_FIELD_TYPE_CHECKBOX PluginFieldType = "checkbox" //多选
	PLUGIN_FIELD_TYPE_SELECT   PluginFieldType = "select"   //下拉
	PLUGIN_FIELD_TYPE_SWITCH   PluginFieldType = "switch"   //开关

	PLUGIN_FIELD_DISPLAY_INLINE PluginFieldDisplay = "inline" //内联
	PLUGIN_FIELD_DISPLAY_BLOCK  PluginFieldDisplay = "block"  //块级

	PLUGIN_FIELD_CLEAR_NONE  PluginFieldClear = "none"  //默认
	PLUGIN_FIELD_CLEAR_LEFT  PluginFieldClear = "left"  //左边
	PLUGIN_FIELD_CLEAR_RIGHT PluginFieldClear = "right" //右边
	PLUGIN_FIELD_CLEAR_BOTH  PluginFieldClear = "both"  //两边
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APPAddHttpInput

type APPAddHttpInput struct {
	AppID    string `json:"app_id" form:"app_id" comment:"�租户id" validate:"required"`
	Name     string `json:"name" form:"name" comment:"租户名称" validate:"required"`
	Secret   string `json:"secret" form:"secret" comment:"密钥" validate:""`
	WhiteIPS string `json:"white_ips" form:"white_ips" comment:"ip白名单,支持前缀匹配"`
	Qpd      int64  `json:"qpd" form:"qpd" comment:"日请求量限制" validate:""`
	Qps      int64  `json:"qps" form:"qps" comment:"每秒请求量限制" validate:""`
}

func (*APPAddHttpInput) GetValidParams

func (params *APPAddHttpInput) GetValidParams(c *gin.Context) error

type APPDetailInput

type APPDetailInput struct {
	ID int64 `json:"id" form:"id" comment:"租户ID" validate:"required"`
}

func (*APPDetailInput) GetValidParams

func (params *APPDetailInput) GetValidParams(c *gin.Context) error

type APPListInput

type APPListInput struct {
	Info     string `json:"info" form:"info" comment:"查找信息" validate:""`
	PageSize int    `json:"page_size" form:"page_size" comment:"页数" validate:"required,min=1,max=999"`
	PageNo   int    `json:"page_no" form:"page_no" comment:"页码" validate:"required,min=1,max=999"`
}

func (*APPListInput) GetValidParams

func (params *APPListInput) GetValidParams(c *gin.Context) error

type APPListItemOutput

type APPListItemOutput struct {
	ID        int64     `json:"id" gorm:"primary_key"`
	AppID     string    `json:"app_id" gorm:"column:app_id" description:"�租户id	"`
	Name      string    `json:"name" gorm:"column:name" description:"租户名称	"`
	Secret    string    `json:"secret" gorm:"column:secret" description:"密钥"`
	WhiteIPS  string    `json:"white_ips" gorm:"column:white_ips" description:"ip白名单,支持前缀匹配		"`
	Qpd       int64     `json:"qpd" gorm:"column:qpd" description:"日请求量限制"`
	Qps       int64     `json:"qps" gorm:"column:qps" description:"每秒请求量限制"`
	RealQpd   int64     `json:"real_qpd" description:"日请求量限制"`
	RealQps   int64     `json:"real_qps" description:"每秒请求量限制"`
	UpdatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"添加时间	"`
	CreatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	IsDelete  int8      `json:"is_delete" gorm:"column:is_delete" description:"是否已删除;0:否;1:是"`
}

type APPListOutput

type APPListOutput struct {
	List  []APPListItemOutput `json:"list" form:"list" comment:"租户列表"`
	Total int64               `json:"total" form:"total" comment:"租户总数"`
}

type APPUpdateHttpInput

type APPUpdateHttpInput struct {
	ID       int64  `json:"id" form:"id" gorm:"column:id" comment:"主键ID" validate:"required"`
	AppID    string `json:"app_id" form:"app_id" gorm:"column:app_id" comment:"租户id" validate:""`
	Name     string `json:"name" form:"name" gorm:"column:name" comment:"租户名称" validate:"required"`
	Secret   string `json:"secret" form:"secret" gorm:"column:secret" comment:"密钥" validate:"required"`
	WhiteIPS string `json:"white_ips" form:"white_ips" gorm:"column:white_ips" comment:"ip白名单,支持前缀匹配		"`
	Qpd      int64  `json:"qpd" form:"qpd" gorm:"column:qpd" comment:"日请求量限制"`
	Qps      int64  `json:"qps" form:"qps" gorm:"column:qps" comment:"每秒请求量限制"`
}

func (*APPUpdateHttpInput) GetValidParams

func (params *APPUpdateHttpInput) GetValidParams(c *gin.Context) error

type Admin

type Admin struct {
	Id        int       `json:"id" gorm:"primary_key" description:"自增主键"`
	UserName  string    `json:"user_name" gorm:"column:user_name" description:"管理员用户名"`
	Salt      string    `json:"salt" gorm:"column:salt" description:"盐"`
	Password  string    `json:"password" gorm:"column:password" description:"密码"`
	UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	IsDelete  int       `json:"is_delete" gorm:"column:is_delete" description:"是否删除"`
}

func (*Admin) Find

func (t *Admin) Find(c *gin.Context, tx *gorm.DB, search *Admin) (*Admin, error)

func (*Admin) LoginCheck

func (t *Admin) LoginCheck(c *gin.Context, tx *gorm.DB, param *AdminLoginInput) (*Admin, error)

func (*Admin) Save

func (t *Admin) Save(c *gin.Context, tx *gorm.DB) error

func (*Admin) TableName

func (t *Admin) TableName() string

type AdminInfoOutput

type AdminInfoOutput struct {
	ID           int       `json:"id"`
	Name         string    `json:"name"`
	LoginTime    time.Time `json:"login_time"`
	Avatar       string    `json:"avatar"`
	Introduction string    `json:"introduction"`
	Roles        []string  `json:"roles"`
}

type AdminLoginInput

type AdminLoginInput struct {
	UserName string `json:"username" form:"username" comment:"管理员用户名" example:"admin" validate:"required,valid_username"` //管理员用户名
	Password string `json:"password" form:"password" comment:"密码" example:"123456" validate:"required"`                   //密码
}

func (*AdminLoginInput) BindValidParam

func (param *AdminLoginInput) BindValidParam(c *gin.Context) error

type AdminLoginOutput

type AdminLoginOutput struct {
	Token string `json:"token" form:"token" comment:"token" example:"token" validate:""` //token
}

type AdminSessionInfo

type AdminSessionInfo struct {
	ID        int       `json:"id"`
	UserName  string    `json:"user_name"`
	LoginTime time.Time `json:"login_time"`
}

type App

type App struct {
	ID        int64     `json:"id" gorm:"primary_key"`
	AppID     string    `json:"app_id" gorm:"column:app_id" description:"租户id"`
	Name      string    `json:"name" gorm:"column:name" description:"租户名称	"`
	Secret    string    `json:"secret" gorm:"column:secret" description:"密钥"`
	WhiteIPS  string    `json:"white_ips" gorm:"column:white_ips" description:"ip白名单,支持前缀匹配"`
	Qpd       int64     `json:"qpd" gorm:"column:qpd" description:"日请求量限制"`
	Qps       int64     `json:"qps" gorm:"column:qps" description:"每秒请求量限制"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"添加时间	"`
	UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	IsDelete  int8      `json:"is_delete" gorm:"column:is_delete" description:"是否已删除;0:否;1:是"`
}

func (*App) APPList

func (t *App) APPList(c *gin.Context, tx *gorm.DB, params *APPListInput) ([]App, int64, error)

func (*App) Find

func (t *App) Find(c *gin.Context, tx *gorm.DB, search *App) (*App, error)

func (*App) Save

func (t *App) Save(c *gin.Context, tx *gorm.DB) error

func (*App) TableName

func (t *App) TableName() string

type ChangePwdInput

type ChangePwdInput struct {
	Password string `json:"password" form:"password" comment:"密码" example:"123456" validate:"required"` //密码
}

func (*ChangePwdInput) BindValidParam

func (param *ChangePwdInput) BindValidParam(c *gin.Context) error

type DashServiceStatItemOutput

type DashServiceStatItemOutput struct {
	Name     string `json:"name"`
	LoadType int    `json:"load_type"`
	Value    int64  `json:"value"`
}

type DashServiceStatOutput

type DashServiceStatOutput struct {
	Legend []string                    `json:"legend"`
	Data   []DashServiceStatItemOutput `json:"data"`
}

type HTTPProxyMiddleware

type HTTPProxyMiddleware interface {
	Configration()
	GetConfig() *PluginConfig
	Handler(c *gin.Context)
}

type PanelGroupDataOutput

type PanelGroupDataOutput struct {
	ServiceNum      int64 `json:"serviceNum"`
	AppNum          int64 `json:"appNum"`
	CurrentQPS      int64 `json:"currentQps"`
	TodayRequestNum int64 `json:"todayRequestNum"`
}

type PluginConfig

type PluginConfig struct {
	DisplayName string             `toml:"display_name" json:"display_name"` //插件名
	Sort        int                `toml:"sort" json:"sort"`                 //显示顺序
	Postion     PluginPosition     `toml:"postion" json:"postion"`           //显示位置
	UniqueName  string             `toml:"unique_name" json:"unique_name"`   //唯一名称
	Items       []PluginItemConfig `toml:"items" json:"items"`
}

type PluginConfigs

type PluginConfigs struct {
	HTTP []PluginConfig `toml:"http" json:"http"`
	TCP  []PluginConfig `toml:"tcp" json:"tcp"`
	GRCP []PluginConfig `toml:"grpc" json:"grpc"`
}

func GetPluginConfig

func GetPluginConfig() (*PluginConfigs, error)

type PluginFieldClear

type PluginFieldClear string

type PluginFieldDisplay

type PluginFieldDisplay string

type PluginFieldType

type PluginFieldType string

type PluginItemConfig

type PluginItemConfig struct {
	FieldType         PluginFieldType    `toml:"field_type" json:"field_type"`                   //表单类型 文字=input,文本域=textarea,单选=radio,多选=checkbox,下拉=select,开关=switch
	FieldDisplay      PluginFieldDisplay `toml:"field_display" json:"field_display"`             //显示样式 内联=inline,块=black
	FieldClear        PluginFieldClear   `toml:"field_clear" json:"field_clear"`                 //显示清空 清空左=left
	FieldPlaceholder  string             `toml:"field_placeholder" json:"field_placeholder"`     //占位符
	FieldOption       string             `toml:"field_option" json:"field_option"`               //可选值,radio、check、select时的value
	FieldValue        string             `toml:"field_value" json:"field_value"`                 //字段值
	FieldDefaultValue string             `toml:"field_default_value" json:"field_default_value"` //字段默认值,checkbox时 111|222 表示选中多个值
	FieldUniqueName   string             `toml:"field_unique_name" json:"field_unique_name"`     //字段唯一标识
	FieldDisplayName  string             `toml:"field_display_name" json:"field_display_name"`   //字段显示名称,radio、check、select时的name
	FieldRequired     bool               `toml:"field_required" json:"field_required"`           //是否必填
	FieldValidRule    string             `toml:"field_valid_rule" json:"field_valid_rule"`       //验证规则
}

type PluginPosition

type PluginPosition string

type ServiceAddGrpcInput

type ServiceAddGrpcInput struct {
	ServiceName       string `json:"service_name" form:"service_name" comment:"服务名称" validate:"required,valid_service_name"`
	ServiceDesc       string `json:"service_desc" form:"service_desc" comment:"服务描述" validate:"required"`
	Port              int    `json:"port" form:"port" comment:"端口,需要设置8001-8999范围内" validate:"required,min=8001,max=8999"`
	HeaderTransfor    string `json:"header_transfor" form:"header_transfor" comment:"metadata转换" validate:"valid_header_transfor"`
	OpenAuth          int    `json:"open_auth" form:"open_auth" comment:"是否开启权限验证" validate:""`
	BlackList         string `` /* 135-byte string literal not displayed */
	WhiteList         string `` /* 135-byte string literal not displayed */
	WhiteHostName     string `json:"white_host_name" form:"white_host_name" comment:"白名单主机,以逗号间隔" validate:"valid_iplist"`
	ClientIPFlowLimit int    `json:"clientip_flow_limit" form:"clientip_flow_limit" comment:"客户端IP限流" validate:""`
	ServiceFlowLimit  int    `json:"service_flow_limit" form:"service_flow_limit" comment:"服务端限流" validate:""`
	RoundType         int    `json:"round_type" form:"round_type" comment:"轮询策略" validate:""`
	IpList            string `json:"ip_list" form:"ip_list" comment:"IP列表" validate:"required,valid_ipportlist"`
	WeightList        string `json:"weight_list" form:"weight_list" comment:"权重列表" validate:"required,valid_weightlist"`
	ForbidList        string `json:"forbid_list" form:"forbid_list" comment:"禁用IP列表" validate:"valid_iplist"`
}

func (*ServiceAddGrpcInput) GetValidParams

func (params *ServiceAddGrpcInput) GetValidParams(c *gin.Context) error

type ServiceAddInput

type ServiceAddInput struct {
	ServiceName         string `json:"service_name" form:"service_name" comment:"服务名称" example:"" validate:"required,valid_service_name"` //服务名称
	ServiceDesc         string `json:"service_desc" form:"service_desc" comment:"服务描述" example:"" validate:"required,max=255,min=1"`      //服务描述
	LoadType            int    `json:"load_type" form:"load_type" comment:"负载类型 0=http 1=tcp 2=grpc"`
	HTTPHosts           string `json:"http_hosts" form:"http_hosts" comment:"域名信息" example:"" validate:""`
	HTTPPaths           string `json:"http_paths" form:"http_paths" comment:"路径信息" example:"" validate:""`
	NeedStripUri        int    `json:"need_strip_uri" form:"need_strip_uri" comment:"启用strip_uri" example:"" validate:""` //启用strip_uri
	Port                int    `json:"port" form:"port" comment:"tcp/grpc端口"`
	LoadBalanceStrategy string `json:"load_balance_strategy" form:"load_balance_strategy" comment:"负载策略"`
	LoadBalanceType     string `json:"load_balance_type" form:"load_balance_type" comment:"负载类型"`
	AuthType            string `json:"auth_type" form:"auth_type" comment:"鉴权类型"`
	UpstreamList        string `json:"upstream_list" form:"upstream_list" comment:"下游服务器ip和权重"`
	PluginConf          string `json:"plugin_conf" form:"plugin_conf" comment:"插件配置"`
}

func (*ServiceAddInput) BindValidParam

func (param *ServiceAddInput) BindValidParam(c *gin.Context) error

type ServiceAddTcpInput

type ServiceAddTcpInput struct {
	ServiceName    string `json:"service_name" form:"service_name" comment:"服务名称" validate:"required,valid_service_name"`
	ServiceDesc    string `json:"service_desc" form:"service_desc" comment:"服务描述" validate:"required"`
	Port           int    `json:"port" form:"port" comment:"端口,需要设置8001-8999范围内" validate:"required,min=8001,max=8999"`
	HeaderTransfor string `json:"header_transfor" form:"header_transfor" comment:"header头转换" validate:"
"`
	OpenAuth          int    `json:"open_auth" form:"open_auth" comment:"是否开启权限验证" validate:""`
	BlackList         string `` /* 135-byte string literal not displayed */
	WhiteList         string `` /* 135-byte string literal not displayed */
	WhiteHostName     string `json:"white_host_name" form:"white_host_name" comment:"白名单主机,以逗号间隔" validate:"valid_iplist"`
	ClientIPFlowLimit int    `json:"clientip_flow_limit" form:"clientip_flow_limit" comment:"客户端IP限流" validate:""`
	ServiceFlowLimit  int    `json:"service_flow_limit" form:"service_flow_limit" comment:"服务端限流" validate:""`
	RoundType         int    `json:"round_type" form:"round_type" comment:"轮询策略" validate:""`
	IpList            string `json:"ip_list" form:"ip_list" comment:"IP列表" validate:"required,valid_ipportlist"`
	WeightList        string `json:"weight_list" form:"weight_list" comment:"权重列表" validate:"required,valid_weightlist"`
	ForbidList        string `json:"forbid_list" form:"forbid_list" comment:"禁用IP列表" validate:"valid_iplist"`
}

func (*ServiceAddTcpInput) GetValidParams

func (params *ServiceAddTcpInput) GetValidParams(c *gin.Context) error

type ServiceDeleteInput

type ServiceDeleteInput struct {
	ID int64 `json:"id" form:"id" comment:"服务ID" example:"56" validate:"required"` //服务ID
}

func (*ServiceDeleteInput) BindValidParam

func (param *ServiceDeleteInput) BindValidParam(c *gin.Context) error

type ServiceDetail

type ServiceDetail struct {
	Info       *ServiceInfo     `json:"info" description:"基本信息"`
	PluginConf *simplejson.Json `json:"plugin_conf" description:"plugin_conf"`
}

func GetServiceDetailFromGinContext

func GetServiceDetailFromGinContext(c *gin.Context) (*ServiceDetail, error)

type ServiceDetailInput

type ServiceDetailInput struct {
	ID int64 `json:"id" form:"id" comment:"服务ID" example:"56" validate:"required"` //服务ID
}

func (*ServiceDetailInput) BindValidParam

func (param *ServiceDetailInput) BindValidParam(c *gin.Context) error

type ServiceInfo

type ServiceInfo struct {
	ID                  int64     `json:"id" gorm:"primary_key"`
	ServiceType         int       `json:"service_type" gorm:"column:service_type" description:"服务类型 0=http 1=tcp 2=grpc"`
	ServiceName         string    `json:"service_name" gorm:"column:service_name" description:"服务名称"`
	ServiceDesc         string    `json:"service_desc" gorm:"column:service_desc" description:"服务描述"`
	ServicePort         int       `json:"service_port" gorm:"column:service_port" description:"服务端口(只针对 tcp/grpc)"`
	HTTPHosts           string    `json:"http_hosts" gorm:"column:http_hosts" description:"域名信息"`
	HTTPPaths           string    `json:"http_paths" gorm:"column:http_paths" description:"路径信息"`
	HttpStripPrefix     int       `json:"http_strip_prefix" gorm:"column:http_strip_prefix" description:"http转发前剥离前缀"`
	LoadBalanceStrategy string    `json:"load_balance_strategy" gorm:"column:load_balance_strategy" description:"负载策略"`
	LoadBalanceType     string    `json:"load_balance_type" gorm:"column:load_balance_type" description:"负载类型"`
	AuthType            string    `json:"auth_type" gorm:"column:auth_type" description:"鉴权类型"`
	UpstreamList        string    `json:"upstream_list" form:"upstream_list" comment:"下游服务器ip和权重"`
	PluginConf          string    `json:"plugin_conf" gorm:"column:plugin_conf" description:"插件配置"`
	CreatedAt           time.Time `json:"create_at" gorm:"column:create_at" description:"更新时间"`
	UpdatedAt           time.Time `json:"update_at" gorm:"column:update_at" description:"添加时间"`
	IsDelete            int8      `json:"is_delete" gorm:"column:is_delete" description:"是否已删除;0:否;1:是"`
}

func (*ServiceInfo) Delete

func (t *ServiceInfo) Delete(c *gin.Context, tx *gorm.DB, search *ServiceInfo) error

func (*ServiceInfo) Find

func (t *ServiceInfo) Find(c *gin.Context, tx *gorm.DB, search *ServiceInfo) (*ServiceInfo, error)

func (*ServiceInfo) GroupByLoadType

func (t *ServiceInfo) GroupByLoadType(c *gin.Context, tx *gorm.DB) ([]DashServiceStatItemOutput, error)

func (*ServiceInfo) PageList

func (t *ServiceInfo) PageList(c *gin.Context, tx *gorm.DB, param *ServiceListInput) ([]ServiceInfo, int64, error)

func (*ServiceInfo) Save

func (t *ServiceInfo) Save(c *gin.Context, tx *gorm.DB) error

func (*ServiceInfo) ServiceDetail

func (t *ServiceInfo) ServiceDetail(c *gin.Context, tx *gorm.DB, info *ServiceInfo) (*ServiceDetail, error)

func (*ServiceInfo) TableName

func (t *ServiceInfo) TableName() string

type ServiceListInput

type ServiceListInput struct {
	Info     string `json:"info" form:"info" comment:"关键词" example:"" validate:""`                      //关键词
	PageNo   int    `json:"page_no" form:"page_no" comment:"页数" example:"1" validate:"required"`        //页数
	PageSize int    `json:"page_size" form:"page_size" comment:"每页条数" example:"20" validate:"required"` //每页条数
}

func (*ServiceListInput) BindValidParam

func (param *ServiceListInput) BindValidParam(c *gin.Context) error

type ServiceListItemOutput

type ServiceListItemOutput struct {
	ID          int64  `json:"id" form:"id"`                     //id
	ServiceName string `json:"service_name" form:"service_name"` //服务名称
	ServiceDesc string `json:"service_desc" form:"service_desc"` //服务描述
	LoadType    int    `json:"load_type" form:"load_type"`       //类型
	ServiceAddr string `json:"service_addr" form:"service_addr"` //服务地址
	Qps         int64  `json:"qps" form:"qps"`                   //qps
	Qpd         int64  `json:"qpd" form:"qpd"`                   //qpd
	TotalNode   int    `json:"total_node" form:"total_node"`     //节点数
	ActiveNode  int    `json:"active_node" form:"active_node"`   //活跃的节点数
}

type ServiceListOutput

type ServiceListOutput struct {
	Total int64                   `json:"total" form:"total" comment:"总数" example:"" validate:""` //总数
	List  []ServiceListItemOutput `json:"list" form:"list" comment:"列表" example:"" validate:""`   //列表
}

type ServiceStatOutput

type ServiceStatOutput struct {
	Today     []int64 `json:"today" form:"today" comment:"今日流量" example:"" validate:""`         //列表
	Yesterday []int64 `json:"yesterday" form:"yesterday" comment:"昨日流量" example:"" validate:""` //列表
}

type ServiceUpdateGrpcInput

type ServiceUpdateGrpcInput struct {
	ID                int64  `json:"id" form:"id" comment:"服务ID" validate:"required"`
	ServiceName       string `json:"service_name" form:"service_name" comment:"服务名称" validate:"required,valid_service_name"`
	ServiceDesc       string `json:"service_desc" form:"service_desc" comment:"服务描述" validate:"required"`
	Port              int    `json:"port" form:"port" comment:"端口,需要设置8001-8999范围内" validate:"required,min=8001,max=8999"`
	HeaderTransfor    string `json:"header_transfor" form:"header_transfor" comment:"metadata转换" validate:"valid_header_transfor"`
	OpenAuth          int    `json:"open_auth" form:"open_auth" comment:"是否开启权限验证" validate:""`
	BlackList         string `` /* 135-byte string literal not displayed */
	WhiteList         string `` /* 135-byte string literal not displayed */
	WhiteHostName     string `json:"white_host_name" form:"white_host_name" comment:"白名单主机,以逗号间隔" validate:"valid_iplist"`
	ClientIPFlowLimit int    `json:"clientip_flow_limit" form:"clientip_flow_limit" comment:"客户端IP限流" validate:""`
	ServiceFlowLimit  int    `json:"service_flow_limit" form:"service_flow_limit" comment:"服务端限流" validate:""`
	RoundType         int    `json:"round_type" form:"round_type" comment:"轮询策略" validate:""`
	IpList            string `json:"ip_list" form:"ip_list" comment:"IP列表" validate:"required,valid_ipportlist"`
	WeightList        string `json:"weight_list" form:"weight_list" comment:"权重列表" validate:"required,valid_weightlist"`
	ForbidList        string `json:"forbid_list" form:"forbid_list" comment:"禁用IP列表" validate:"valid_iplist"`
}

func (*ServiceUpdateGrpcInput) GetValidParams

func (params *ServiceUpdateGrpcInput) GetValidParams(c *gin.Context) error

type ServiceUpdateInput

type ServiceUpdateInput struct {
	ID                  int64  `json:"id" form:"id" comment:"服务ID" example:"62" validate:"required,min=1"`                                //服务ID
	ServiceName         string `json:"service_name" form:"service_name" comment:"服务名称" example:"" validate:"required,valid_service_name"` //服务名称
	ServiceDesc         string `json:"service_desc" form:"service_desc" comment:"服务描述" example:"" validate:"required,max=255,min=1"`      //服务描述
	LoadType            int    `json:"load_type" form:"load_type" comment:"负载类型 0=http 1=tcp 2=grpc"`
	HTTPHosts           string `json:"http_hosts" form:"http_hosts" comment:"域名信息" example:""`
	HTTPPaths           string `json:"http_paths" form:"http_paths" comment:"路径信息" example:""`
	NeedStripUri        int    `json:"need_strip_uri" form:"need_strip_uri" comment:"启用strip_uri" example:"" validate:""` //启用strip_uri  max=1,min=0
	Port                int    `json:"port" form:"port" comment:"tcp/grpc端口"`
	LoadBalanceStrategy string `json:"load_balance_strategy" form:"load_balance_strategy" comment:"负载策略"`
	LoadBalanceType     string `json:"load_balance_type" form:"load_balance_type" comment:"负载类型"`
	AuthType            string `json:"auth_type" form:"auth_type" comment:"鉴权类型"`
	UpstreamList        string `json:"upstream_list" form:"upstream_list" comment:"下游服务器ip和权重"`
	PluginConf          string `json:"plugin_conf" form:"plugin_conf" comment:"插件配置"`
}

func (*ServiceUpdateInput) BindValidParam

func (param *ServiceUpdateInput) BindValidParam(c *gin.Context) error

type ServiceUpdateTcpInput

type ServiceUpdateTcpInput struct {
	ID                int64  `json:"id" form:"id" comment:"服务ID" validate:"required"`
	ServiceName       string `json:"service_name" form:"service_name" comment:"服务名称" validate:"required,valid_service_name"`
	ServiceDesc       string `json:"service_desc" form:"service_desc" comment:"服务描述" validate:"required"`
	Port              int    `json:"port" form:"port" comment:"端口,需要设置8001-8999范围内" validate:"required,min=8001,max=8999"`
	OpenAuth          int    `json:"open_auth" form:"open_auth" comment:"是否开启权限验证" validate:""`
	BlackList         string `` /* 135-byte string literal not displayed */
	WhiteList         string `` /* 135-byte string literal not displayed */
	WhiteHostName     string `json:"white_host_name" form:"white_host_name" comment:"白名单主机,以逗号间隔" validate:"valid_iplist"`
	ClientIPFlowLimit int    `json:"clientip_flow_limit" form:"clientip_flow_limit" comment:"客户端IP限流" validate:""`
	ServiceFlowLimit  int    `json:"service_flow_limit" form:"service_flow_limit" comment:"服务端限流" validate:""`
	RoundType         int    `json:"round_type" form:"round_type" comment:"轮询策略" validate:""`
	IpList            string `json:"ip_list" form:"ip_list" comment:"IP列表" validate:"required,valid_ipportlist"`
	WeightList        string `json:"weight_list" form:"weight_list" comment:"权重列表" validate:"required,valid_weightlist"`
	ForbidList        string `json:"forbid_list" form:"forbid_list" comment:"禁用IP列表" validate:"valid_iplist"`
}

func (*ServiceUpdateTcpInput) GetValidParams

func (params *ServiceUpdateTcpInput) GetValidParams(c *gin.Context) error

type StatisticsOutput

type StatisticsOutput struct {
	Today     []int64 `json:"today" form:"today" comment:"今日统计" validate:"required"`
	Yesterday []int64 `json:"yesterday" form:"yesterday" comment:"昨日统计" validate:"required"`
}

type TokensInput

type TokensInput struct {
	GrantType string `json:"grant_type" form:"grant_type" comment:"授权类型" example:"client_credentials" validate:"required"` //授权类型
	Scope     string `json:"scope" form:"scope" comment:"权限范围" example:"read_write" validate:"required"`                   //权限范围
}

func (*TokensInput) BindValidParam

func (param *TokensInput) BindValidParam(c *gin.Context) error

type TokensOutput

type TokensOutput struct {
	AccessToken string `json:"access_token" form:"access_token"` //access_token
	ExpiresIn   int    `json:"expires_in" form:"expires_in"`     //expires_in
	TokenType   string `json:"token_type" form:"token_type"`     //token_type
	Scope       string `json:"scope" form:"scope"`               //scope
}

type UpstreamConfig

type UpstreamConfig struct {
	Schema   string
	IpList   []string
	IpWeight map[string]string
}

func GetUpstreamConfigFromString

func GetUpstreamConfigFromString(upstreamList string) (*UpstreamConfig, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL