httpserver

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port                         string        // 端口号
	ReadTimeoutMillisecond       time.Duration // 读取数据最大时间
	ReadHeaderTimeoutMillisecond time.Duration // 读取请求头最大时间
	WriteTimeoutMillisecond      time.Duration // 写响应最大时间
	IdleTimeoutMillisecond       time.Duration // 空闲连接最大时间
	MaxHeaderBytes               int           // 最大请求头大小
	IsOpenConnStateTraceLog      bool          // 是否开启连接状态追踪日志
	ShutdownTimeoutSecond        int           // 优雅关闭超时时间(秒)
}

type Manager

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

Manager HTTP服务器管理器,负责HTTP服务器的创建、配置和生命周期管理

func NewManager

func NewManager(configPath string, handler http.Handler) *Manager

NewManager 创建新的HTTP服务器管理器 configPath: 配置文件路径 handler: HTTP处理器

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

Run 启动HTTP服务器并阻塞直到服务器关闭或发生错误 ctx: 用于控制服务器生命周期的context

type Router

type Router interface {
	RegisterHandler(*Manager)
}

Jump to

Keyboard shortcuts

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