server

package
v0.13.14 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 31 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 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 {
	Version string
}

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 {
	Name() (name string)
	Build(options *HandlerOptions) (err error)
	Handle(writer http.ResponseWriter, request *http.Request) (ok bool)
	Close()
}

func NewCorsHandler

func NewCorsHandler() (h Handler)

func NewDocumentHandler

func NewDocumentHandler(options DocumentHandlerOptions) (h Handler)

func NewHealthHandler

func NewHealthHandler(options HealthHandlerOptions) (h Handler)

func NewServiceHandler

func NewServiceHandler() (h Handler)

func NewWebsocketHandler added in v0.12.6

func NewWebsocketHandler() (h Handler)

func PprofHandler added in v0.12.2

func PprofHandler() (h Handler)

type HandlerOptions added in v0.13.3

type HandlerOptions struct {
	Log       logs.Logger
	Config    configures.Config
	Endpoints service.Endpoints
}

type Handlers

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

func NewHandlers

func NewHandlers(options *HandlerOptions) (handlers *Handlers)

func (*Handlers) Append

func (handlers *Handlers) Append(h Handler) (err error)

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 License

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

type PprofArgument added in v0.12.6

type PprofArgument struct {
	Password string `json:"password"`
	Sec      int    `json:"sec"`
}

type PprofHandlerOptions

type PprofHandlerOptions struct {
	Password string
}

type WebsocketEndpoint added in v0.12.6

type WebsocketEndpoint interface {
	Id() (id string)
	Write(ctx context.Context, message interface{}) (err errors.CodeError)
	Close()
}

type WebsocketMessage added in v0.12.6

type WebsocketMessage struct {
	Header http.Header     `json:"header"`
	Body   json.RawMessage `json:"body"`
}

type WebsocketRequest added in v0.13.11

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

func NewWebsocketRequest added in v0.12.6

func NewWebsocketRequest(msg *WebsocketMessage, remoteIp string) (r *WebsocketRequest, err errors.CodeError)

func (*WebsocketRequest) Argument added in v0.13.11

func (r *WebsocketRequest) Argument() (argument service.Argument)

func (*WebsocketRequest) Authorization added in v0.13.11

func (r *WebsocketRequest) Authorization() (v string)

func (*WebsocketRequest) Fn added in v0.13.11

func (r *WebsocketRequest) Fn() (service string, fn string)

func (*WebsocketRequest) Hash added in v0.13.11

func (r *WebsocketRequest) Hash() (code uint64)

func (*WebsocketRequest) Header added in v0.13.11

func (r *WebsocketRequest) Header() (header service.RequestHeader)

func (*WebsocketRequest) Id added in v0.13.11

func (r *WebsocketRequest) Id() (id string)

func (*WebsocketRequest) Internal added in v0.13.11

func (r *WebsocketRequest) Internal() (ok bool)

func (*WebsocketRequest) Local added in v0.13.11

func (r *WebsocketRequest) Local() (local service.RequestLocal)

func (*WebsocketRequest) RemoteIp added in v0.13.11

func (r *WebsocketRequest) RemoteIp() (v string)

func (*WebsocketRequest) SetUser added in v0.13.11

func (r *WebsocketRequest) SetUser(id string, attr *json.Object)

func (*WebsocketRequest) User added in v0.13.11

func (r *WebsocketRequest) User() (user service.RequestUser)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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