service

package
v0.0.0-...-5105834 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApplicationStatusStopped 应用停止
	ApplicationStatusStopped int32 = iota + 1
	// ApplicationStatusRunning 应用运行中
	ApplicationStatusRunning
	// ApplicationStatusStopping 应用正在停止
	ApplicationStatusStopping
)

Variables

This section is empty.

Functions

func ApplicationIsRunning

func ApplicationIsRunning() bool

ApplicationIsRunning 判断应用是否正在运行

func DecHTTPConnProcessing

func DecHTTPConnProcessing()

dec http connection processing

func DecreaseConcurrency

func DecreaseConcurrency() int32

DecreaseConcurrency 当前并发请求-1

func GetApplicationBuildedAt

func GetApplicationBuildedAt() string

GetApplicationBuildedAt 获取应用构建时间

func GetApplicationHostname

func GetApplicationHostname() string

GetApplicationHostname 获取应用运行的hostname

func GetApplicationStatus

func GetApplicationStatus() int32

GetApplicationStatus 获取应用运行状态

func GetApplicationVersion

func GetApplicationVersion() string

GetApplicationVersion 获取应用版本号

func GetConcurrency

func GetConcurrency() int32

GetConcurrency 获取当前并发请求

func GetHTTPServerConnState

func GetHTTPServerConnState() func(net.Conn, http.ConnState)

GetHTTPServerConnState get http server on conn state function

func GetIPBlockList

func GetIPBlockList() []string

GetIPBlockList 获取block的ip地址列表

func GetSignedKeys

func GetSignedKeys() elton.SignedKeysGenerator

GetSignedKeys 获取用于cookie加密的key列表

func IncreaseConcurrency

func IncreaseConcurrency() int32

IncreaseConcurrency 当前并发请求+1

func IsBlockIP

func IsBlockIP(ip string) bool

IsBlockIP 判断该IP是否有需要拦截

func ResetIPBlocker

func ResetIPBlocker(ipList []string) error

ResetIPBlocker 重置IP拦截器的IP列表

func SetApplicationBuildedAt

func SetApplicationBuildedAt(v string)

SetApplicationBuildedAt 设置应用构建时间

func SetApplicationStatus

func SetApplicationStatus(status int32)

SetApplicationStatus 设置应用运行状态

func SetApplicationVersion

func SetApplicationVersion(v string)

SetApplicationVersion 设置应用版本号

func UpdateCPUUsage

func UpdateCPUUsage(ctx context.Context) error

UpdateCPUUsage 更新cpu使用率

func ValidateCaptcha

func ValidateCaptcha(ctx context.Context, id, value string) (bool, error)

ValidateCaptcha 校验图形验证码是否正确

Types

type CaptchaInfo

type CaptchaInfo struct {
	ExpiredAt time.Time `json:"expiredAt"`
	Data      []byte    `json:"data"`
	// json输出时,忽略此字段
	Value string `json:"-"`
	ID    string `json:"id"`
	Type  string `json:"type"`
}

CaptchaInfo 图形验证码

func GetCaptcha

func GetCaptcha(ctx context.Context, fontColor, bgColor string) (*CaptchaInfo, error)

GetCaptcha 获取图形验证码

type ConfigurationSrv

type ConfigurationSrv struct{}

ConfigurationSrv 配置的相关函数

func (*ConfigurationSrv) Refresh

func (srv *ConfigurationSrv) Refresh() error

Refresh 刷新配置

type CurrentValidConfiguration

type CurrentValidConfiguration struct {
	UpdatedAt         time.Time                        `json:"updatedAt"`
	MockTime          string                           `json:"mockTime"`
	IPBlockList       []string                         `json:"ipBlockList"`
	SignedKeys        []string                         `json:"signedKeys"`
	RouterConcurrency map[string]uint32                `json:"routerConcurrency"`
	RouterMock        map[string]routermock.RouterMock `json:"routerMock"`
	Limits            map[string]int                   `json:"limits"`
}

CurrentValidConfiguration 当前有效配置

func GetCurrentValidConfiguration

func GetCurrentValidConfiguration() *CurrentValidConfiguration

GetCurrentValidConfiguration 获取当前有效配置

type InfluxSrv

type InfluxSrv struct {
	// contains filtered or unexported fields
}

func GetInfluxSrv

func GetInfluxSrv() *InfluxSrv

GetInfluxSrv 获取默认的influxdb服务

func (*InfluxSrv) ListField

func (srv *InfluxSrv) ListField(ctx context.Context, measurement, duration string) (fields []string, err error)

ListField return the fields of measurement

func (*InfluxSrv) ListTag

func (srv *InfluxSrv) ListTag(ctx context.Context, measurement string) (tags []string, err error)

ListTag returns the tag list of measurement

func (*InfluxSrv) ListTagValue

func (srv *InfluxSrv) ListTagValue(ctx context.Context, measurement, tag string) (values []string, err error)

ListTagValue list value of tag

func (*InfluxSrv) Query

func (srv *InfluxSrv) Query(ctx context.Context, query string) (items []map[string]interface{}, err error)

func (*InfluxSrv) Write

func (srv *InfluxSrv) Write(measurement string, tags map[string]string, fields map[string]interface{}, ts ...time.Time)

Write 写入数据

type Performance

type Performance struct {
	Concurrency           int32 `json:"concurrency"`
	RequestProcessedTotal int64 `json:"requestProcessedTotal"`
	performance.CPUMemory
	HTTPServerConnStats *performance.ConnStats          `json:"httpServerConnStats"`
	IOCountersStat      *performance.IOCountersStat     `json:"ioCountersStat"`
	ConnStat            *performance.ConnectionsCount   `json:"connStat"`
	NumCtxSwitchesStat  *performance.NumCtxSwitchesStat `json:"numCtxSwitchesStat"`
	PageFaultsStat      *performance.PageFaultsStat     `json:"pageFaultsStat"`
	NumFdsStat          *performance.NumFdsStat         `json:"numFdsStat"`
	OpenFilesStats      *performance.OpenFilesStat      `json:"openFilesStats"`
}

Performance 应用性能指标

func GetPerformance

func GetPerformance(ctx context.Context) *Performance

GetPerformance 获取应用性能指标

type RequestLimitConfiguration

type RequestLimitConfiguration struct {
	Name string `json:"name"`
	Max  int    `json:"max"`
}

RequestLimitConfiguration HTTP请求实例并发限制

Jump to

Keyboard shortcuts

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