Help us shape the future of Go! Take the 2026 Go Developer Survey

endpoint

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build added in v0.7.0

func Build(mux *http.ServeMux, config *Config, datastores map[string]*datastore.Service, healthHandler *health.HealthHandler, metrics *gmetric.Service) error

func IsHelpOption

func IsHelpOption(args []string) bool

IsHelpOption returns true if helper

func NewConfigHandler

func NewConfigHandler(config *Config) http.Handler

func NewProfHandler added in v0.4.0

func NewProfHandler() *memProfHandler

func RunApp

func RunApp(Version string, args []string, wg *sync.WaitGroup)

RunApp run application

func RunAppError added in v0.4.0

func RunAppError(Version string, args []string, wg *sync.WaitGroup) error

func RunAppWithConfig

func RunAppWithConfig(Version string, args []string, configProvider func(options *Options) (*Config, error))

RunAppWithConfig run application

func RunAppWithConfigError added in v0.4.0

func RunAppWithConfigError(Version string, args []string, configProvider func(options *Options) (*Config, error)) error

Types

type AuthHandler added in v0.7.0

type AuthHandler struct {
	*Config
	// contains filtered or unexported fields
}

func NewAuthHandler added in v0.7.0

func NewAuthHandler(config *Config, handler http.Handler) *AuthHandler

func (*AuthHandler) ServeHTTP added in v0.7.0

func (h *AuthHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type AuthMux added in v0.7.0

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

func NewAuthMux added in v0.7.0

func NewAuthMux(mux *http.ServeMux, config *Config) *AuthMux

func (*AuthMux) Handle added in v0.7.0

func (m *AuthMux) Handle(path string, handler http.Handler)

func (*AuthMux) HandleFunc added in v0.7.0

func (m *AuthMux) HandleFunc(path string, hf func(w http.ResponseWriter, r *http.Request))

type Config

type Config struct {
	config.ModelList      `json:",omitempty" yaml:",inline"`
	sconfig.DatastoreList `json:",omitempty" yaml:",inline"`

	Endpoint      econfig.Endpoint
	EnableMemProf bool
	EnableCPUProf bool
	AllowedSubnet []string `json:",omitempty" yaml:",omitempty"`
}

Config represents an endpoint config

func NewConfigFromURL

func NewConfigFromURL(ctx context.Context, URL string) (*Config, error)

NewConfigFromURL creates a new config from URL

func (*Config) Init

func (c *Config) Init()

Init initialise config

func (*Config) LoadFromURL

func (c *Config) LoadFromURL(ctx context.Context, URL string, target interface{}) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates config

type Options

type Options struct {
	ConfigURL string `short:"c" long:"cfg" description:"config URI"`
	Version   bool   `short:"v" long:"version" description:"indexer version"`
}

Options represents an option

type Service

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

Service represents http bridge

func New

func New(cfg *Config) (*Service, error)

func (*Service) Listen added in v0.6.0

func (s *Service) Listen() (net.Listener, error)

func (*Service) ListenAndServe

func (s *Service) ListenAndServe() error

Deprecated - use Listen and Serve separately

func (*Service) ListenAndServeTLS

func (s *Service) ListenAndServeTLS(certFile, keyFile string) error

ListenAndServeTLS start https endpoint on secure port

func (*Service) SelfTest added in v0.6.0

func (s *Service) SelfTest() error

Runs a client side call for each model once.

func (*Service) Serve added in v0.6.0

func (s *Service) Serve(l net.Listener) error

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

Shutdown stops http.Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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