server

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerContextKey = &contextKey{"Server"}
View Source
var (
	Version string = "Server/2.2.1"
)

默认4K

Functions

This section is empty.

Types

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

type ServerGroup

type ServerGroup struct {
	ErrorLog      *log.Logger                         // 错误日志文件
	DynamicModule map[string]vweb.DynamicTemplateFunc // 支持更多动态

	Route *vweb.Route // 地址路由
	// contains filtered or unexported fields
}

func NewServerGroup

func NewServerGroup() *ServerGroup

func (*ServerGroup) Close

func (T *ServerGroup) Close() error

关闭服务集群

error   错误

func (*ServerGroup) GetServer

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

读取一个服务器

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

func (*ServerGroup) LoadConfigFile

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

挂载本地配置文件。

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

func (*ServerGroup) SetServer

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

增加一个服务器

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

func (*ServerGroup) SetSiteMan added in v2.4.8

func (T *ServerGroup) SetSiteMan(man *vweb.SiteMan) error

设置一个站点管理, 随配置文件变动, man 原来的保存内容可能会被删除或增加。

man *vweb.SiteMan	站点管理
error				错误

func (*ServerGroup) SetSitePool

func (T *ServerGroup) SetSitePool(pool *vweb.SitePool) error

设置一个站点池, 随配置文件变动, pool 原来的保存内容可能会被删除或增加。

pool *vweb.SitePool	池
error				错误

func (*ServerGroup) Start

func (T *ServerGroup) Start() error

启动服务集群

error   错误

func (*ServerGroup) UpdateConfig

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

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

conf *config.Config        配置
error               错误

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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