restserver

package
v0.0.0-...-a23f37e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*gin.Engine
	// contains filtered or unexported fields
}

Server wrapper for gin.Engine

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Endpoint

func (s *Server) Endpoint() (*url.URL, error)

func (*Server) RegistryWebsocket

func (s *Server) RegistryWebsocket(relativePath string)

func (*Server) SocketIoServer

func (s *Server) SocketIoServer() *socketio.Server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start rest server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

func (*Server) Translator

func (s *Server) Translator() ut.Translator

type ServerOption

type ServerOption func(*Server)

func WithAddress

func WithAddress(addr string) ServerOption

func WithClientEnableTracing

func WithClientEnableTracing(enableTracing bool) ServerOption

WithClientEnableTracing 设置是否开启链路追踪

func WithDebugMode

func WithDebugMode() ServerOption

func WithEnTransNames

func WithEnTransNames() ServerOption

func WithEnableMetrics

func WithEnableMetrics(enable bool) ServerOption

func WithEnableProfiling

func WithEnableProfiling(enable bool) ServerOption

func WithEnableSocketIoServer

func WithEnableSocketIoServer(enableSocketIoServer bool) ServerOption

func WithMiddlewares

func WithMiddlewares(middlewares ...gin.HandlerFunc) ServerOption

func WithReleaseMode

func WithReleaseMode() ServerOption

func WithSocketIoServer

func WithSocketIoServer(socketIoServer *socketio.Server) ServerOption

func WithTLSConfig

func WithTLSConfig(certFile, keyFile string) ServerOption

WithTLSConfig with TLS config.

func WithTestMode

func WithTestMode() ServerOption

func WithTransName

func WithTransName(transName string) ServerOption

func WithZhTransNames

func WithZhTransNames() ServerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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