server

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handler() interface{}
}

Handler handler 的包装接口

type Option

type Option func(*Options)

func Address

func Address(addr string) Option

func TLSConfig

func TLSConfig(conf *tls.Config) Option

type Options

type Options struct {
	// Address 为服务指定地址 ex: :8080
	Address string
	// TLSConfig 为服务指定 TLS 配置
	TLSConfig *tls.Config
}

type Server

type Server interface {
	// Init 初始化服务
	Init(...Option)
	// Options 获取服务的配置选项
	Options() Options
	// Handle 设置服务的 handler
	Handle(Handler) error
	// NewHandler 创建一个 handler 包装
	NewHandler(interface{}) Handler
	// Start 启动服务
	Start() error
	// Stop 实现服务优雅退出
	Stop() error
}

Jump to

Keyboard shortcuts

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