server

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package rlimit contains a function to raise rlimit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Raise

func Raise(limit uint64) error

Raise raises the number of file descriptors that can be opened.

Types

type Option

type Option func(*Server)

Option 修改 server 相关参数

func DefaultPrintln

func DefaultPrintln() Option

DefaultPrintln 默认输出信息

func ErrorLog

func ErrorLog(log *log.Logger) Option

func Port

func Port(v string) Option

Port 修改端口

func ReadTimeout

func ReadTimeout(v time.Duration) Option

func ShutdownTimeout

func ShutdownTimeout(v time.Duration) Option

ShutdownTimeout 停止服务超时时间

func WriteTimeout

func WriteTimeout(v time.Duration) Option

type Server

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

Server HTTP 服务

func New

func New(handler http.Handler, opts ...Option) *Server

New 初始化并启动路由

func (*Server) Notify

func (s *Server) Notify() <-chan error

Notify .

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown 关闭服务

func (*Server) Start

func (s *Server) Start()

func (*Server) StartTLS

func (s *Server) StartTLS(certFile, keyFile string)

Jump to

Keyboard shortcuts

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