interfaces

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServices = map[string]bool{
	"debug.Testing/Input":  true,
	"debug.Testing/Stream": true,
	"debug.Info/Request":   true,
	"grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo": true,
}

Functions

func CreateDiscoveryRequest

func CreateDiscoveryRequest(id string, driver string) *global.DiscoveryRequest

func CreatePushRequest

func CreatePushRequest(id string, r *http.Request) *global.PushRequest

func CreatePushResponse

func CreatePushResponse(id string, statusCode int,
	endOfStreams bool, h http.Header, body []byte) *global.PushResponse

Types

type EventTypeProcess

type EventTypeProcess string
const (
	EventTypeProcessSplitter               EventTypeProcess = "http.splitter"
	EventTypeProcessHttpHandler            EventTypeProcess = "http.handler"
	EventTypeProcessHttpController         EventTypeProcess = "http.controller"
	EventTypeProcessGRPCWebController      EventTypeProcess = "grpc.web.controller"
	EventTypeProcessGRPCController         EventTypeProcess = "grpc.controller"
	EventTypeProcessHttpMiddlewareCompress EventTypeProcess = "http.middleware.compress"
)

type Interceptor

type Interceptor struct {
	UnaryServerInterceptor  grpc.UnaryServerInterceptor
	StreamServerInterceptor grpc.StreamServerInterceptor
}

type Listener

type Listener interface {
	Init(opt Options, interceptor ...Interceptor)
	Run() (err error)
	RunRouter() (err error)
	// handle grpc, grpc-web and http
	RegisterMultipleHandler(MethodMultipleHandler)
	PushRouterListener(*listener.RouterListener, http.HandlerFunc)
	SetTracer(tracing.Tracing)

	//Get from main modules
	GetServices() []string
	GetAllServices() (res []*listener.ServicesItems)
	GetOptions() Options
	GetTracer() tracing.Tracing
	GetMonitor() *listener.MonitorResponse
}

listener modules interface, using for dynamic modules

type Method

type Method string
const (
	MethodGET    Method = "GET"
	MethodPOST   Method = "POST"
	MethodPUT    Method = "PUT"
	MethodDELETE Method = "DELETE"
)

type MethodMultipleHandler

type MethodMultipleHandler interface{}

type MultipleHandlerOption

type MultipleHandlerOption interface {
	GetServiceDesc() []*grpc.ServiceDesc
	AllowMethod(string) []Method
}

MultipleHandlerOption -

type OnPushMessage

type OnPushMessage func(data *global.PushRequest, onMsg OnPushMessageResponse)

type OnPushMessageResponse

type OnPushMessageResponse func(*global.PushResponse)

type Options

type Options struct {
	ServiceName      string
	Listen           string
	Port             Port
	Logger           logger.Logger
	Pem              string
	DisableSecure    bool
	IsRouter         bool
	EnableEncryption bool
	Database         database.Database
	Discover         *listener.Discovery
	MaxRequest       int64
	Driver           string
	UseAuthCallback  UseAuthCallback
}

type Port

type Port struct {
	Insecure int
	Secure   int
}

type UseAuthCallback

type UseAuthCallback func(r *http.Request) bool

Jump to

Keyboard shortcuts

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