ginutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCALHOST = "localhost"
	PORT8080  = 8080
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LierGin

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

func NewGin

func NewGin(options ...LierGinOption) *LierGin

func (*LierGin) SetRouters

func (l *LierGin) SetRouters(routerFunc ...Router)

func (*LierGin) SetServer

func (l *LierGin) SetServer(c *Server)

func (*LierGin) Start

func (l *LierGin) Start() error

func (*LierGin) Stop

func (l *LierGin) Stop()

Stop http server stop

type LierGinOption

type LierGinOption func(*LierGin)

func WithEngine

func WithEngine(engine *gin.Engine) LierGinOption

WithEngine set server handler

func WithGinRouters

func WithGinRouters(routerFunc ...Router) LierGinOption

func WithGinServer

func WithGinServer(c *Server) LierGinOption

func WithLogger

func WithLogger(logger alog.Logger) LierGinOption

WithLogger set logger

func WithName

func WithName(name string) LierGinOption

WithName set service name

type Router

type Router func(router *gin.Engine, logger alog.Logger)

type Server

type Server struct {
	http.Server
}

func NewServer

func NewServer(options ...ServerOption) *Server

type ServerOption

type ServerOption func(server *Server)

func BaseContext

func BaseContext(f func(net.Listener) context.Context) ServerOption

BaseContext sets the server base context.

func ConnContext

func ConnContext(f func(context.Context, net.Conn) context.Context) ServerOption

ConnContext sets the server connection context.

func ConnState

func ConnState(f func(net.Conn, http.ConnState)) ServerOption

ConnState sets the server connection state.

func ErrorLog

func ErrorLog(logger *log.Logger) ServerOption

ErrorLog sets the server error log.

func WithServerAddr

func WithServerAddr(addr string) ServerOption

WithServerAddr sets the server address.

func WithServerIdleTimeout

func WithServerIdleTimeout(timeout time.Duration) ServerOption

WithServerIdleTimeout sets the server idle timeout.

func WithServerMaxHeaderBytes

func WithServerMaxHeaderBytes(size int) ServerOption

WithServerMaxHeaderBytes sets the server max header bytes.

func WithServerReadHeaderTimeout

func WithServerReadHeaderTimeout(timeout time.Duration) ServerOption

WithServerReadHeaderTimeout sets the server read header timeout.

func WithServerReadTimeout

func WithServerReadTimeout(timeout time.Duration) ServerOption

WithServerReadTimeout sets the server read timeout.

func WithServerTLSConfig

func WithServerTLSConfig(config *tls.Config) ServerOption

WithServerTLSConfig sets the server TLS config.

func WithServerTLSNextProto

func WithServerTLSNextProto(proto map[string]func(*http.Server, *tls.Conn, http.Handler)) ServerOption

WithServerTLSNextProto sets the server TLS next proto.

func WithServerWriteTimeout

func WithServerWriteTimeout(timeout time.Duration) ServerOption

WithServerWriteTimeout sets the server write timeout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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