grpc_context

package
v0.15.12 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnShutdown = errors.New("grpc conn shutdown")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Get

func (c *Client) Get(target string, isTls bool, host ...string) IClientPool

type ClientOption

type ClientOption struct {
	ClientPoolConnSize int
	IsTls              bool
	Authority          string
	DialTimeOut        time.Duration
	KeepAlive          time.Duration
	KeepAliveTimeout   time.Duration
}

type ClientPool

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

func NewClientPoolWithOption

func NewClientPoolWithOption(target string, option *ClientOption) *ClientPool

func (*ClientPool) Close

func (cc *ClientPool) Close()

func (*ClientPool) ConnCount

func (cc *ClientPool) ConnCount() int64

func (*ClientPool) Get

func (cc *ClientPool) Get() (*grpc.ClientConn, error)

type Context

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

func NewContext

func NewContext(srv interface{}, stream grpc.ServerStream) *Context

func (*Context) AcceptTime

func (c *Context) AcceptTime() time.Time

func (*Context) Assert

func (c *Context) Assert(i interface{}) error

func (*Context) Clone added in v0.12.1

func (c *Context) Clone() (eocontext.EoContext, error)

func (*Context) Context

func (c *Context) Context() context.Context

func (*Context) EnableTls

func (c *Context) EnableTls(b bool)

func (*Context) FastFinish

func (c *Context) FastFinish() error

func (*Context) GetBalance

func (c *Context) GetBalance() eocontext.BalanceHandler

func (*Context) GetComplete

func (c *Context) GetComplete() eocontext.CompleteHandler

func (*Context) GetFinish

func (c *Context) GetFinish() eocontext.FinishHandler

func (*Context) GetLabel

func (c *Context) GetLabel(name string) string

func (*Context) GetUpstreamHostHandler

func (c *Context) GetUpstreamHostHandler() eocontext.UpstreamHostHandler

func (*Context) InsecureCertificateVerify

func (c *Context) InsecureCertificateVerify(b bool)

func (*Context) Invoke

func (c *Context) Invoke(node eocontext.INode, timeout time.Duration) error

func (*Context) IsCloneable added in v0.12.1

func (c *Context) IsCloneable() bool

func (*Context) Labels

func (c *Context) Labels() map[string]string

func (*Context) LocalAddr

func (c *Context) LocalAddr() net.Addr

func (*Context) LocalIP

func (c *Context) LocalIP() net.IP

func (*Context) LocalPort

func (c *Context) LocalPort() int

func (*Context) Proxy

func (c *Context) Proxy() grpc_context.IRequest

func (*Context) RealIP added in v0.12.5

func (c *Context) RealIP() string

func (*Context) Request

func (c *Context) Request() grpc_context.IRequest

func (*Context) RequestId

func (c *Context) RequestId() string

func (*Context) Response

func (c *Context) Response() grpc_context.IResponse

func (*Context) Scheme

func (c *Context) Scheme() string

func (*Context) SetBalance

func (c *Context) SetBalance(handler eocontext.BalanceHandler)

func (*Context) SetCompleteHandler

func (c *Context) SetCompleteHandler(handler eocontext.CompleteHandler)

func (*Context) SetFinish

func (c *Context) SetFinish(handler eocontext.FinishHandler)

func (*Context) SetLabel

func (c *Context) SetLabel(name, value string)

func (*Context) SetResponse

func (c *Context) SetResponse(response grpc_context.IResponse)

func (*Context) SetUpstreamHostHandler

func (c *Context) SetUpstreamHostHandler(handler eocontext.UpstreamHostHandler)

func (*Context) Value

func (c *Context) Value(key interface{}) interface{}

func (*Context) WithValue

func (c *Context) WithValue(key, val interface{})

type IClient

type IClient interface {
	Get(target string, isTls bool, host ...string) IClientPool
	Close()
}

type IClientPool

type IClientPool interface {
	Get() (*grpc.ClientConn, error)
	ConnCount() int64
	Close()
}

type Request

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

func NewRequest

func NewRequest(stream grpc.ServerStream) *Request

func (*Request) ForwardIP

func (r *Request) ForwardIP() string

func (*Request) FullMethodName

func (r *Request) FullMethodName() string

func (*Request) Headers

func (r *Request) Headers() metadata.MD

func (*Request) Host

func (r *Request) Host() string

func (*Request) Message

func (r *Request) Message(msgDesc *desc.MessageDescriptor) *dynamic.Message

func (*Request) Method

func (r *Request) Method() string

func (*Request) RealIP

func (r *Request) RealIP() string

func (*Request) Service

func (r *Request) Service() string

func (*Request) SetHost

func (r *Request) SetHost(s string)

func (*Request) SetMethod

func (r *Request) SetMethod(method string)

func (*Request) SetService

func (r *Request) SetService(service string)

type Response

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

func NewResponse

func NewResponse() *Response

func (*Response) Error

func (r *Response) Error() error

func (*Response) Headers

func (r *Response) Headers() metadata.MD

func (*Response) Message

func (r *Response) Message() *dynamic.Message

func (*Response) SetErr

func (r *Response) SetErr(err error)

func (*Response) Trailer

func (r *Response) Trailer() metadata.MD

func (*Response) Write

func (r *Response) Write(msg *dynamic.Message)

Jump to

Keyboard shortcuts

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