Documentation ¶
Index ¶
- Variables
- func RegisterPlugin(name string, plugin Plugin)
- func SetPluginConfig(c *Config)
- type AddCheckRequest
- type CMDB
- type CheckRequest
- type CheckResponse
- type CompositeHistory
- type Config
- type ConfigEntry
- type Crypto
- type CryptoManager
- type DiscoverChannel
- type HealthCheckType
- type HealthChecker
- type History
- type ParsePassword
- type Plugin
- type PluginChanConfig
- type QueryRequest
- type QueryResponse
- type Ratelimit
- type RatelimitType
- type ReportRequest
- type Statis
- type Whitelist
Constants ¶
This section is empty.
Variables ¶
var RatelimitStr = map[RatelimitType]string{ IPRatelimit: "ip-limit", APIRatelimit: "api-limit", ServiceRatelimit: "service-limit", InstanceRatelimit: "instance-limit", }
RatelimitStr rate limit string map
Functions ¶
Types ¶
type AddCheckRequest ¶
AddCheckRequest add check request
type CMDB ¶
type CMDB interface { Plugin // GetLocation 在CMDB中没有找到Host,返回error为nil,location为nil // 插件内部出现错误,返回error不为nil,忽略location GetLocation(host string) (*model.Location, error) // Range 提供一个Range接口,遍历所有的数据 // 遍历失败,通过Range返回值error可以额捕获 // 参数为一个回调函数 // 返回值:bool,是否继续遍历 // 返回值:error,回调函数处理结果,error不为nil,则停止遍历过程,并且通过Range返回error Range(handler func(host string, location *model.Location) (bool, error)) error // Size 获取当前CMDB存储的entry个数 Size() int32 }
CMDB CMDB插件接口
type CheckRequest ¶
type CheckRequest struct { QueryRequest ExpireDurationSec uint32 CurTimeSec func() int64 }
CheckRequest check heartbeat request
type CheckResponse ¶
type CheckResponse struct { Healthy bool LastHeartbeatTimeSec int64 StayUnchanged bool Regular bool }
CheckResponse check heartbeat response
type CompositeHistory ¶ added in v1.14.0
type CompositeHistory struct {
// contains filtered or unexported fields
}
func (*CompositeHistory) Destroy ¶ added in v1.14.0
func (c *CompositeHistory) Destroy() error
func (*CompositeHistory) Initialize ¶ added in v1.14.0
func (c *CompositeHistory) Initialize(config *ConfigEntry) error
func (*CompositeHistory) Name ¶ added in v1.14.0
func (c *CompositeHistory) Name() string
func (*CompositeHistory) Record ¶ added in v1.14.0
func (c *CompositeHistory) Record(entry *model.RecordEntry)
type Config ¶
type Config struct { CMDB ConfigEntry `yaml:"cmdb"` RateLimit ConfigEntry `yaml:"ratelimit"` History PluginChanConfig `yaml:"history"` Statis PluginChanConfig `yaml:"statis"` DiscoverStatis ConfigEntry `yaml:"discoverStatis"` ParsePassword ConfigEntry `yaml:"parsePassword"` Whitelist ConfigEntry `yaml:"whitelist"` MeshResourceValidate ConfigEntry `yaml:"meshResourceValidate"` DiscoverEvent PluginChanConfig `yaml:"discoverEvent"` Crypto PluginChanConfig `yaml:"crypto"` }
Config 插件配置
type ConfigEntry ¶
ConfigEntry 单个插件配置
type Crypto ¶ added in v1.17.2
type Crypto interface { Plugin GenerateKey() ([]byte, error) Encrypt(plaintext string, key []byte) (cryptotext string, err error) Decrypt(cryptotext string, key []byte) (string, error) }
Crypto Crypto interface
type CryptoManager ¶ added in v1.17.2
type CryptoManager interface { Name() string Initialize() error Destroy() error GetCryptoAlgoNames() []string GetCrypto(algo string) (Crypto, error) }
CryptoManager crypto algorithm manager
func GetCryptoManager ¶ added in v1.17.2
func GetCryptoManager() CryptoManager
GetCrypto get the crypto plugin
type DiscoverChannel ¶
type DiscoverChannel interface { Plugin // PublishEvent Release a service event PublishEvent(event model.InstanceEvent) }
DiscoverChannel is used to receive discover events from the agent
func GetDiscoverEvent ¶
func GetDiscoverEvent() DiscoverChannel
GetDiscoverEvent Get service discovery event plug -in
type HealthCheckType ¶
type HealthCheckType int32
HealthCheckType health check type
const (
HealthCheckerHeartbeat HealthCheckType = iota + 1
)
type HealthChecker ¶
type HealthChecker interface { Plugin // Type for health check plugin, only one same type plugin is allowed Type() HealthCheckType // Report process heartbeat info report Report(ctx context.Context, request *ReportRequest) error // Check process the instance check Check(request *CheckRequest) (*CheckResponse, error) // Query queries the heartbeat time Query(ctx context.Context, request *QueryRequest) (*QueryResponse, error) // Suspend health checker for entire expired duration manually Suspend() // SuspendTimeSec get the suspend time in seconds SuspendTimeSec() int64 // Delete delete the id Delete(ctx context.Context, id string) error // DebugHandlers return debug handlers DebugHandlers() []model.DebugHandler }
HealthChecker health checker plugin interface
func GetHealthChecker ¶
func GetHealthChecker(name string, cfg *ConfigEntry) HealthChecker
GetHealthChecker get the health checker by name
type ParsePassword ¶
ParsePassword Password plug -in
func GetParsePassword ¶
func GetParsePassword() ParsePassword
GetParsePassword Get the parsing password plug -in
type Plugin ¶
type Plugin interface { Name() string Initialize(c *ConfigEntry) error Destroy() error }
Plugin 通用插件接口
type PluginChanConfig ¶ added in v1.14.0
type PluginChanConfig struct { Name string `yaml:"name"` Option map[string]interface{} `yaml:"option"` Entries []ConfigEntry `yaml:"entries"` }
PluginChanConfig 插件执行链配置
type QueryRequest ¶
QueryRequest query heartbeat request
type QueryResponse ¶
QueryResponse query heartbeat response
type Ratelimit ¶
type Ratelimit interface { Plugin // Allow Whether to allow access, true: allow, FALSE: not allowing Todo // - Parameter ratingype is the type of current limits, and the ID is the key that limits the current // - If RateType is Ratelimitip, the ID is IP, RateType is Ratelimitservice, and the ID is // IP_NAMESPACE_SERVICE or IP_SERVICEID Allow(typ RatelimitType, key string) bool }
Ratelimit Ratelimit plugin interface
type RatelimitType ¶
type RatelimitType int
RatelimitType rate limit type
const ( // IPRatelimit Based on IP flow control IPRatelimit RatelimitType = iota + 1 // APIRatelimit Based on interface-level flow control APIRatelimit // ServiceRatelimit Based on Service flow control ServiceRatelimit // InstanceRatelimit Based on Instance flow control InstanceRatelimit )
type ReportRequest ¶
type ReportRequest struct { QueryRequest LocalHost string CurTimeSec int64 Count int64 }
ReportRequest report heartbeat request
type Statis ¶
type Statis interface { Plugin // ReportCallMetrics report call metrics info ReportCallMetrics(metric metrics.CallMetric) // ReportDiscoveryMetrics report discovery metrics ReportDiscoveryMetrics(metric ...metrics.DiscoveryMetric) // ReportConfigMetrics report config_center metrics ReportConfigMetrics(metric ...metrics.ConfigMetrics) // ReportDiscoverCall report discover service times ReportDiscoverCall(metric metrics.ClientDiscoverMetric) }
Statis Statistical plugin interface