httpserv

package
v0.0.0-...-6470968 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpParams

type HttpParams struct {
	HttpAddr         string            `json:"httpAddr" mapstructure:"httpAddr"`
	HttpsAddr        string            `json:"httpsAddr" mapstructure:"httpsAddr"`
	Cert             string            `json:"cert" mapstructure:"cert"`
	Key              string            `json:"key" mapstructure:"key"`
	AllowOrigin      []string          `json:"allowOrigin" mapstructure:"allowOrigin"`
	AllowMethods     []string          `json:"allowMethods" mapstructure:"allowMethods"`
	AllowHeaders     []string          `json:"AllowHeaders" mapstructure:"AllowHeaders"`
	ExposeHeaders    []string          `json:"exposeHeaders" mapstructure:"exposeHeaders"`
	AllowCredentials bool              `json:"allowCredentials" mapstructure:"allowCredentials"`
	MaxAge           int               `json:"maxAge" mapstructure:"maxAge"`
	Headers          map[string]string `json:"headers" mapstructure:"headers"`
	AllowOriginHook  string            `json:"allowOriginHook" mapstructure:"allowOriginHook"`
}

type Server

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

func NewServer

func NewServer(ctx context.Context, handler http.Handler, opts ...ServerOption) *Server

func (*Server) Close

func (s *Server) Close()

type ServerOption

type ServerOption func(*Server)

func WithHeaders

func WithHeaders(headers map[string]string) ServerOption

func WithListener

func WithListener(ln net.Listener) ServerOption

func WithLogger

func WithLogger(logger *logrus.Entry) ServerOption

func WithSSL

func WithSSL(cert, key string) ServerOption

type SignalServer

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

func NewSignalServer

func NewSignalServer(ctx context.Context, params HttpParams, logger *logrus.Entry) *SignalServer

func (*SignalServer) AllowHeaders

func (ss *SignalServer) AllowHeaders() []string

func (*SignalServer) AllowMethods

func (ss *SignalServer) AllowMethods() []string

func (*SignalServer) AllowOrigin

func (ss *SignalServer) AllowOrigin() []string

func (*SignalServer) Close

func (ss *SignalServer) Close() error

func (*SignalServer) DefaultRouter

func (ss *SignalServer) DefaultRouter() *gin.Engine

func (*SignalServer) Start

func (ss *SignalServer) Start(handles ...gin.HandlerFunc) error

Jump to

Keyboard shortcuts

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