service

package
v0.0.0-...-7f5b3d9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 38 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 GetAvailableConfigurations

func GetAvailableConfigurations(ctx context.Context) ([]*ent.Configuration, error)

GetAvailableConfigurations 获取当前有效配置

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 NewTicker

func NewTicker() *finalizer

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(ctx context.Context) error

Refresh 刷新配置

type Performance

type Performance struct {
	Concurrency           int32 `json:"concurrency"`
	RequestProcessedTotal int64 `json:"requestProcessedTotal"`
	performance.CPUMemory
	HTTPServerConnStats *performance.ConnStats `json:"httpServerConnStats"`
	*performance.Performance
}

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