server

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerContextKey = &contextKey{"Server"}
View Source
var Version string = "Server/v3"

Functions

This section is empty.

Types

type Group

type Group struct {
	ErrorLog *log.Logger                                      // 错误日志文件
	Module   func(name string) (vweb.DynamicTemplater, error) // 支持更动态文件类型

	CertManager *autocert.Manager // 自动申请证书 Let's Encrypt
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup() *Group

func (*Group) Close

func (T *Group) Close() error

Close 关闭服务集群

error   错误

func (*Group) GetServer

func (T *Group) GetServer(laddr string) (*Server, bool)

GetServer 读取一个服务器

laddr string	监听地址
*Server			服务器
bool			如果存在服务器, 返回true。否则返回false

func (*Group) LoadConfigFile

func (T *Group) LoadConfigFile(p string) (ok bool, err error)

LoadConfigFile 挂载本地配置文件。

p string        文件路径
ok bool			true配置文件被修改过, false没有变动
err error       错误

func (*Group) SetServer

func (T *Group) SetServer(laddr string, srv *Server) error

SetServer 增加一个服务器

laddr string	监听地址
srv *Server		服务器, 如果为nil, 则删除已存在的记录

func (*Group) SetSessionExpiryInterval

func (T *Group) SetSessionExpiryInterval(d time.Duration)

SetSessionExpiryInterval 设置session的过期时间, 随配置文件变动, d 原来的保存内容可能会被删除或增加。

func (*Group) SiteMan

func (T *Group) SiteMan() *vweb.SiteMan

SiteMan 站点管理器, 用于获取和设置站点信息。

func (*Group) Start

func (T *Group) Start() error

Start 启动服务集群

error   错误

func (*Group) UpdateConfig

func (T *Group) UpdateConfig(conf *config.Config) error

UpdateConfig 更新配置并把配置分配到各个地方。不检查改动, 直接更新。更新配置需要调用 .Start 方法之后才生效。

conf *config.Config        配置
error               错误

type Server

type Server struct {
	*http.Server // http服务器
	Addr         string
	// contains filtered or unexported fields
}

Server 服务器,使用在 ServerGroup.srvMan 字段。

func (*Server) ConfigConn

func (T *Server) ConfigConn(cc *config.Conn) error

func (*Server) ConfigServer

func (T *Server) ConfigServer(cs *config.Server) error

func (*Server) ListenAndServe

func (T *Server) ListenAndServe() error

func (*Server) Serve

func (T *Server) Serve(l net.Listener) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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