v0.0.0-...-a89d410 Latest Latest

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 19 Imported by: 0




View Source
const (
	// HeaderAcceptEncoding ...
	HeaderAcceptEncoding = "Accept-Encoding"
	// HeaderContentType ...
	HeaderContentType = "Content-Type"
	// HRPC Errord
	HeaderHRPCErr = "HRPC-Errord"


View Source
const (
	// MIMEApplicationJSON ...
	MIMEApplicationJSON = "application/json"
	// MIMEApplicationJSONCharsetUTF8 ...
	MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8
	// MIMEApplicationProtobuf ...
	MIMEApplicationProtobuf = "application/protobuf"

MIME types

View Source
const ModName = "server.fasthttp"

ModName named a mod


This section is empty.


This section is empty.


type Config

type Config struct {
	Host              string
	Port              int
	Deployment        string
	Debug             bool
	DisableMetric     bool
	DisableTrace      bool
	DisablePrintStack bool
	// ServiceAddress service address in registry info, default to 'Host:Port'
	ServiceAddress string
	CertFile       string
	PrivateFile    string
	EnableTLS      bool

	SlowQueryThresholdInMilli int64
	ReadBufferSize            int
	WriteBufferSize           int
	ReduceMemoryUsage         bool
	Concurrency               int
	// contains filtered or unexported fields

Config HTTP config

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func RawConfig

func RawConfig(key string) *Config

RawConfig ...

func StdConfig

func StdConfig(name string) *Config

StdConfig Sanchin Standard HTTP Server config

func (*Config) Address

func (config *Config) Address() string

Address ...

func (*Config) Build

func (config *Config) Build() (*Server, error)

Build create server instance, then initialize it with necessary interceptor

func (*Config) MustBuild

func (config *Config) MustBuild() *Server

func (*Config) WithHost

func (config *Config) WithHost(host string) *Config

WithHost ...

func (*Config) WithLogger

func (config *Config) WithLogger(logger *xlog.Logger) *Config

WithLogger ...

func (*Config) WithPort

func (config *Config) WithPort(port int) *Config

WithPort ...

type Server

type Server struct {
	// contains filtered or unexported fields

Server ...

func (*Server) GracefulStop

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

GracefulStop implements server.Server interface it will stop echo server gracefully

func (*Server) Healthz

func (s *Server) Healthz() bool

func (*Server) Info

func (s *Server) Info() *server.ServiceInfo

Info returns server info, used by governor and consumer balancer

func (*Server) Serve

func (s *Server) Serve() error

Server implements server.Server interface.

func (*Server) Stop

func (s *Server) Stop() error

Stop implements server.Server interface it will terminate echo server immediately

Jump to

Keyboard shortcuts

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