http

package
v0.0.0-...-aa3a249 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

type File

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

type HTTPServer

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

func NewHTTPServer

func NewHTTPServer(name ...string) *HTTPServer

func (*HTTPServer) DefaultRoute

func (s *HTTPServer) DefaultRoute(handlers ...HandlerFunc)

func (*HTTPServer) Enable

func (s *HTTPServer) Enable() bool

func (*HTTPServer) Init

func (s *HTTPServer) Init(cfg *configure.Configure) error

func (*HTTPServer) Initer

func (s *HTTPServer) Initer(i InitFunc)

func (*HTTPServer) Logger

func (s *HTTPServer) Logger() *zap.Logger

func (*HTTPServer) Name

func (s *HTTPServer) Name() string

func (*HTTPServer) OnShutdown

func (s *HTTPServer) OnShutdown(f ShutdownFunc)

func (*HTTPServer) Route

func (s *HTTPServer) Route(relativePath string, handlers ...HandlerFunc)

func (*HTTPServer) RouterGroup

func (s *HTTPServer) RouterGroup(relativePath string, handlers ...HandlerFunc) RouterGroup

func (*HTTPServer) Server

func (s *HTTPServer) Server() *http.Server

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown()

type HandlerFunc

type HandlerFunc func(r *Request) bool

type HandlersChain

type HandlersChain []HandlerFunc

type IRoutes

type IRoutes interface {
	Route(string, ...HandlerFunc)
}

type InitFunc

type InitFunc func(*configure.ServerConfigure) error

type JSON

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

type Message

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

type PorxyOptions

type PorxyOptions struct {
	Scheme         string
	Address        string
	Method         string
	Uri            string
	Args           string
	Headers        map[string]string
	Body           interface{}
	ConnectTimeout time.Duration
	ReadTimeout    time.Duration
}

type Proxy

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

func NewProxy

func NewProxy(options PorxyOptions) *Proxy

func (*Proxy) Do

func (p *Proxy) Do() (*http.Response, error)

type ProxyOption

type ProxyOption func(*PorxyOptions)

type Reader

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

type Request

type Request struct {
	Context *gin.Context

	Var *Variable

	// request
	Method     string
	Scheme     string
	Host       string
	Uri        string
	RawArgs    string
	Args       map[string]string
	HeadersIn  map[string]string
	BodyReader io.ReadCloser

	// response
	Status     int
	HeadersOut map[string]string
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(c *gin.Context, server *HTTPServer) *Request

func (*Request) BindArgument

func (r *Request) BindArgument(any interface{}) error

func (*Request) BindBody

func (r *Request) BindBody(any interface{}) error

func (*Request) Exit

func (r *Request) Exit(code int, message ...string) bool

func (*Request) Finalize

func (r *Request) Finalize()

func (*Request) GetConfig

func (r *Request) GetConfig() *configure.ModuleConfig

func (*Request) GetFormFile

func (r *Request) GetFormFile(key string) (multipart.File, *multipart.FileHeader, error)

func (*Request) GetModuleCtx

func (r *Request) GetModuleCtx(name string) interface{}

func (*Request) GetMultipartForm

func (r *Request) GetMultipartForm() (*multipart.Form, error)

func (*Request) GetURLParam

func (r *Request) GetURLParam(key string) string

func (*Request) Logger

func (r *Request) Logger() *zap.Logger

func (*Request) NextHandler

func (r *Request) NextHandler() bool

func (*Request) ProxyPass

func (r *Request) ProxyPass(address string, opts ...ProxyOption) bool

func (*Request) ResponseWriter

func (r *Request) ResponseWriter() gin.ResponseWriter

func (*Request) SendBody

func (r *Request) SendBody()

func (*Request) SendBuffer

func (r *Request) SendBuffer(reader io.Reader, size int64) bool

func (*Request) SendFile

func (r *Request) SendFile(filename string) bool

func (*Request) SendHeaders

func (r *Request) SendHeaders()

func (*Request) SendJSON

func (r *Request) SendJSON(m interface{}) bool

func (*Request) SendString

func (r *Request) SendString(message string) bool

func (*Request) SetModuleCtx

func (r *Request) SetModuleCtx(name string, ctx interface{})

func (*Request) WithArgs

func (r *Request) WithArgs(args string) ProxyOption

func (*Request) WithBody

func (r *Request) WithBody(body interface{}) ProxyOption

func (*Request) WithHeaders

func (r *Request) WithHeaders(headers map[string]string) ProxyOption

func (*Request) WithMethod

func (r *Request) WithMethod(method string) ProxyOption

func (*Request) WithScheme

func (r *Request) WithScheme(scheme string) ProxyOption

func (*Request) WithURI

func (r *Request) WithURI(uri string) ProxyOption

type RouterGroup

type RouterGroup interface {
	Group(string, ...HandlerFunc) RouterGroup
	IRoutes
}

type ShutdownFunc

type ShutdownFunc func()

type Variable

type Variable struct {
	RemoteAddr string
	StartTime  int64
	ServerAddr string
	Index      string
	RequestURI string
	LogAttach  string
}

func NewVariable

func NewVariable(server *HTTPServer, ctx *gin.Context) *Variable

Jump to

Keyboard shortcuts

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