Documentation ¶
Index ¶
- func ParseAdminConfig()
- func ParseGatewayInfo(path string) map[string]*GatewayInfo
- func WriteConfigToFile(path string, content []byte) bool
- type Api
- type ApiInfo
- type ApiSlice
- type Backend
- type BackendInfo
- type ConstantParam
- type GatewayInfo
- type GatewaySlice
- type GlobalConfig
- type Group
- type GroupInfo
- type GroupSlice
- type Param
- type RateLimitInfo
- type Strategy
- type StrategyInfo
- type StrategySlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiInfo ¶
type ApiInfo struct { ApiID int `json:"apiID" yaml:"api_id"` ApiName string `json:"apiName" yaml:"api_name"` GroupID int `json:"groupID" yaml:"group_id"` RequestURL string `json:"requestURL" yaml:"request_url"` RequestMethod []string `json:"requestMethod" yaml:"request_method"` BackendID int `json:"backendID" yaml:"backend_id"` ProxyURL string `json:"proxyURL" yaml:"proxy_url"` ProxyMethod string `json:"proxyMethod" yaml:"proxy_method"` IsRaw bool `json:"isRaw" yaml:"is_raw"` ProxyParams []*Param `json:"proxyParams" yaml:"proxy_params"` ConstantParams []*ConstantParam `json:"constantParams" yaml:"constant_params"` Follow bool `json:"follow" yaml:"follow"` UpdateTime string `json:"updateTime" yaml:"update_time"` CreateTime string `json:"createTime" yaml:"createTime"` }
type Backend ¶
type Backend struct {
BackendList []*BackendInfo `json:"backend" yaml:"backend"`
}
type BackendInfo ¶
type BackendInfo struct { BackendID int `json:"backendID" yaml:"backend_id"` BackendName string `json:"backendName" yaml:"backend_name"` BackendPath string `json:"backendPath" yaml:"backend_path"` }
func ParseBackendInfo ¶
func ParseBackendInfo(path string) ([]*BackendInfo, map[int]*BackendInfo)
读入后端信息
type ConstantParam ¶
type GatewayInfo ¶
type GatewayInfo struct { GatewayName string `json:"gatewayName" yaml:"gateway_name"` GatewayAlias string `json:"gatewayAlias" yaml:"gateway_alias"` GatewayStatus string `json:"gatewayStatus" yaml:"gateway_status"` ApiConfPath string `json:"apiConfPath" yaml:"api_conf_path"` ApiGroupConfPath string `json:"apiGroupConfPath" yaml:"api_group_conf_path"` StrategyConfPath string `json:"strategyConfPath" yaml:"strategy_conf_path"` BackendConfPath string `json:"backendConfPath" yaml:"backend_conf_path"` IPLimitType string `json:"ipLimitType,omitempty" yaml:"ip_limit_type,omitempty"` IPWhiteList []string `json:"ipWhiteList,omitempty" yaml:"ip_white_list,omitempty"` IPBlackList []string `json:"ipBlackList,omitempty" yaml:"ip_black_list,omitempty"` UpdateTime string `json:"updateTime,omitempty" yaml:"update_time,omitempty"` CreateTime string `json:"createTime,omitempty" yaml:"create_time,omitempty"` }
type GatewaySlice ¶
type GatewaySlice []map[string]interface{}
按照 Person.Age 从大到小排序
func (GatewaySlice) Len ¶
func (a GatewaySlice) Len() int
func (GatewaySlice) Less ¶
func (a GatewaySlice) Less(i, j int) bool
func (GatewaySlice) Swap ¶
func (a GatewaySlice) Swap(i, j int)
type GlobalConfig ¶
type GlobalConfig struct { Host string `json:"host" yaml:"host"` Port string `json:"port" yaml:"port"` GatewayConfPath string `json:"gatewayConfPath" yaml:"gateway_conf_path"` LoginName string `json:"loginName" yaml:"login_name"` LoginPassword string `json:"loginPassword" yaml:"login_password"` }
var GlobalConf GlobalConfig
type GroupInfo ¶
type GroupSlice ¶
type GroupSlice []*GroupInfo
按照 Person.Age 从大到小排序
func (GroupSlice) Len ¶
func (a GroupSlice) Len() int
func (GroupSlice) Less ¶
func (a GroupSlice) Less(i, j int) bool
func (GroupSlice) Swap ¶
func (a GroupSlice) Swap(i, j int)
type RateLimitInfo ¶
type RateLimitInfo struct { LimitID int `json:"limitID" yaml:"limitI_id"` Allow bool `json:"allow" yaml:"allow"` Period string `json:"period" yaml:"period"` Limit int `json:"limit" yaml:"limit"` Priority int `json:"priority" yaml:"priority"` StartTime int `json:"startTime" yaml:"start_time"` EndTime int `json:"endTime" yaml:"end_time"` }
func ParseRateLimitInfo ¶
func ParseRateLimitInfo(path, strategyID string) ([]*RateLimitInfo, map[int]*RateLimitInfo, []map[string]interface{})
type Strategy ¶
type Strategy struct {
StrategyList []*StrategyInfo `json:"strategy" yaml:"strategy"`
}
type StrategyInfo ¶
type StrategyInfo struct { StrategyName string `json:"strategyName" yaml:"strategy_name"` StrategyID string `json:"strategyID" yaml:"strategy_id"` Auth string `json:"auth,omitempty" yaml:"auth,omitempty"` BasicUserName string `json:"basicUserName,omitempty" yaml:"basic_user_name,omitempty"` BasicUserPassword string `json:"basicUserPassword,omitempty" yaml:"basic_user_password,omitempty"` ApiKey string `json:"apiKey,omitempty" yaml:"api_key"` IPLimitType string `json:"ipLimitType,omitempty" yaml:"ip_limit_type,omitempty"` IPWhiteList []string `json:"ipWhiteList,omitempty" yaml:"ip_white_list,omitempty"` IPBlackList []string `json:"ipBlackList,omitempty" yaml:"ip_black_list,omitempty"` RateLimitList []*RateLimitInfo `json:"rateLimitList,omitempty" yaml:"rate_limit_list,omitempty"` UpdateTime string `json:"updateTime,omitempty" yaml:"update_time,omitempty"` CreateTime string `json:"createTime,omitempty" yaml:"create_time,omitempty"` }
func ParseStrategyInfo ¶
func ParseStrategyInfo(path string) ([]*StrategyInfo, map[string]*StrategyInfo)
读入策略组信息
type StrategySlice ¶
type StrategySlice []map[string]interface{}
func (StrategySlice) Len ¶
func (s StrategySlice) Len() int
func (StrategySlice) Less ¶
func (s StrategySlice) Less(i, j int) bool
func (StrategySlice) Swap ¶
func (s StrategySlice) Swap(i, j int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.