server

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	URL         string `json:"url"`
	Description string `json:"description"`
}

type Contact

type Contact struct {
	Name  string `json:"name"`
	Url   string `json:"url"`
	Email string `json:"email"`
}

type CorsHandlerOptions

type CorsHandlerOptions struct {
	Customized       bool
	AllowedOrigins   []string `copy:"AllowedOrigins"`
	AllowedHeaders   []string `copy:"AllowedHeaders"`
	ExposedHeaders   []string `copy:"ExposedHeaders"`
	AllowCredentials bool     `copy:"AllowCredentials"`
	MaxAge           int      `copy:"MaxAge"`
}

type Document

type Document struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Terms       string    `json:"terms"`
	Contact     *Contact  `json:"contact"`
	License     *License  `json:"license"`
	Addresses   []Address `json:"servers"`
	// contains filtered or unexported fields
}

type DocumentHandlerOptions

type DocumentHandlerOptions struct {
	Log       logs.Logger
	Version   string
	Document  *Document
	Endpoints service.Endpoints
}

type FastHttp

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

func (*FastHttp) Build

func (srv *FastHttp) Build(options HttpOptions) (err error)

func (*FastHttp) Close

func (srv *FastHttp) Close() (err error)

func (*FastHttp) ListenAndServe

func (srv *FastHttp) ListenAndServe() (err error)

type Handler

type Handler interface {
	Handle(writer http.ResponseWriter, request *http.Request) (ok bool)
	Close()
}

func NewCorsHandler

func NewCorsHandler(options CorsHandlerOptions) (h Handler)

func NewDocumentHandler

func NewDocumentHandler(options DocumentHandlerOptions) (h Handler)

func NewHealthHandler

func NewHealthHandler(options HealthHandlerOptions) (h Handler)

func NewServiceHandler

func NewServiceHandler(options ServiceHandlerOptions) (h Handler)

func PprofHandler added in v0.12.2

func PprofHandler() (h Handler)

type Handlers

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

func NewHandlers

func NewHandlers() (handlers *Handlers)

func (*Handlers) Append

func (handlers *Handlers) Append(h Handler)

func (*Handlers) Close

func (handlers *Handlers) Close()

func (*Handlers) ServeHTTP

func (handlers *Handlers) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type HealthHandlerOptions

type HealthHandlerOptions struct {
	AppId   string
	AppName string
	Version string
	Running *commons.SafeFlag
}

type Http

type Http interface {
	Build(options HttpOptions) (err error)
	ListenAndServe() (err error)
	Close() (err error)
}

type HttpClient

type HttpClient interface {
	Do(ctx context.Context, method string, url string, header http.Header, body []byte) (status int, respHeader http.Header, respBody []byte, err error)
	Close()
}

type HttpOptions

type HttpOptions struct {
	Port      int
	ServerTLS *tls.Config
	ClientTLS *tls.Config
	Handler   http.Handler
	Log       logs.Logger
	Raw       *json.Object
}

func (HttpOptions) GetOption

func (options HttpOptions) GetOption(key string, value interface{}) (has bool, err error)

type InterceptorHandler

type InterceptorHandler interface {
	Handler
	Build(options InterceptorHandlerOptions) (err error)
	Name() (name string)
}

type InterceptorHandlerOptions

type InterceptorHandlerOptions struct {
	Log    logs.Logger
	Config configures.Config
}

type License

type License struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type PprofHandlerOptions

type PprofHandlerOptions struct {
	Password string
}

type ServiceHandlerOptions

type ServiceHandlerOptions struct {
	Log       logs.Logger
	Endpoints service.Endpoints
}

Jump to

Keyboard shortcuts

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