crpc

package module
v0.0.0-...-09bd3c0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client[T any](nf gRPCClient[T], hc connect.HTTPClient, addr string, opts ...connect.ClientOption) T

Types

type ApplyToServer

type ApplyToServer func(*ServerOption)

func WithAddr

func WithAddr(addr string) ApplyToServer

func WithCORS

func WithCORS(fn func(h http.Handler) http.Handler) ApplyToServer

func WithCert

func WithCert(cert, key string) ApplyToServer

func WithCertFile

func WithCertFile(certFile, keyFile string) ApplyToServer

func WithCertFromCheck

func WithCertFromCheck(env string, path ...string) ApplyToServer

func WithCertPEM

func WithCertPEM(cert, key []byte) ApplyToServer

func WithH2C

func WithH2C(h2c *http2.Server) ApplyToServer

func WithHTTPServer

func WithHTTPServer(s *http.Server) ApplyToServer

func WithHandle

func WithHandle(h HttpHandle) ApplyToServer

func WithHealthAndMetrics

func WithHealthAndMetrics(addr, _path string) ApplyToServer

type Health

type Health interface {
	IsLive() bool
	IsReady() bool

	SetLive()
	SetNoLive(e string)

	SetReady()
	SetNoReady(e string)
}

type HttpHandle

type HttpHandle interface {
	http.Handler

	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

type Server

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

func NewServer

func NewServer(opt ...ApplyToServer) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Handle

func (s *Server) Handle(pattern string, handler http.Handler)

func (*Server) HandleFunc

func (s *Server) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (Server) IsLive

func (x Server) IsLive() bool

func (Server) IsReady

func (x Server) IsReady() bool

func (Server) Register

func (x Server) Register(h HttpHandle)

func (*Server) Run

func (s *Server) Run() error

func (*Server) RunH2C

func (s *Server) RunH2C() error

func (Server) SetLive

func (x Server) SetLive()

func (Server) SetNoLive

func (x Server) SetNoLive(e string)

func (Server) SetNoReady

func (x Server) SetNoReady(e string)

func (Server) SetReady

func (x Server) SetReady()

type ServerOption

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

Jump to

Keyboard shortcuts

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