server

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForSignal

func WaitForSignal(logger log.Logger, callback func())

WaitForSignal 等待系统信号并执行回调

Types

type Address

type Address struct {
	Network string // 网络类型,如 "tcp"
	Address string // 地址,如 ":8080"
	Path    string // 路径,适用于一些特殊服务器
}

Address 是服务器地址信息

func NewAddress

func NewAddress(endpoint *url.URL) *Address

NewAddress 从URL创建地址信息

func (*Address) String

func (a *Address) String() string

String 返回地址的字符串表示

type Manager

type Manager interface {
	// Add 添加一个服务器
	Add(Server)
	// Start 启动所有服务器
	Start(context.Context) error
	// Stop 停止所有服务器
	Stop(context.Context) error
}

Manager 是服务器管理器的接口

func NewManager

func NewManager(logger log.Logger) Manager

NewManager 创建一个新的服务器管理器

type Server

type Server interface {
	// Start 启动服务器
	Start(context.Context) error
	// Stop 停止服务器
	Stop(context.Context) error
}

Server 是服务器接口的定义

Jump to

Keyboard shortcuts

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