server

package
v0.0.0-...-8228301 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaximumImageSize        = 10 * 1024 * 1024
	AllowedUploadsPerMinute = 100
	RequestInterval         = time.Minute
)

Variables

This section is empty.

Functions

func GetIDHandler

func GetIDHandler(c *gin.Context)

func WsHandlerWithDependencies

func WsHandlerWithDependencies(Token string, BaseUrl string, p *Processor.Processors) gin.HandlerFunc

使用闭包结构 因为gin需要c *gin.Context固定签名

Types

type RateLimiter

type RateLimiter struct {
	Counts map[string][]time.Time
}

func NewRateLimiter

func NewRateLimiter() *RateLimiter

频率限制器

func (*RateLimiter) CheckAndUpdateRateLimit

func (rl *RateLimiter) CheckAndUpdateRateLimit(ipAddress string) bool

检查是否超过调用频率限制

type WebSocketServerClient

type WebSocketServerClient struct {
	Conn    *websocket.Conn
	Token   string
	BaseUrl string
}

func (*WebSocketServerClient) Close

func (client *WebSocketServerClient) Close() error

func (*WebSocketServerClient) SendMessage

func (c *WebSocketServerClient) SendMessage(message map[string]interface{}) error

发信息给client

Jump to

Keyboard shortcuts

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