server

package
v0.0.0-...-e4931e2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: GPL-3.0 Imports: 25 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 HandleIpupdate

func HandleIpupdate(c *gin.Context)

func UploadBase64ImageHandler

func UploadBase64ImageHandler(rateLimiter *RateLimiter) gin.HandlerFunc

闭包,网页后端,图床逻辑,基于gin和www静态文件的简易图床

func UploadBase64RecordHandler

func UploadBase64RecordHandler(rateLimiter *RateLimiter) gin.HandlerFunc

闭包,网页后端,语音床逻辑,基于gin和www静态文件的简易语音床

func WsHandlerWithDependencies

func WsHandlerWithDependencies(s *discordgo.Session, 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
}

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