gorpc

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnInit    = fmt.Errorf("connection is not initilized")
	ErrCertError   = fmt.Errorf("cert error")
	ErrConnect     = fmt.Errorf("fail to connect to the target address")
	ErrInitialized = fmt.Errorf("fail to initilize the connection pool")
	ErrNoServer    = fmt.Errorf("no rpc server")
)

Functions

func DefaultDialerFunc

func DefaultDialerFunc(address string) adapter.DialerFunc

func DefaultTLSDialerFunc

func DefaultTLSDialerFunc(address string, c *tls.Config, onTLSFail func()) adapter.DialerFunc

func IsCertError

func IsCertError(err error) bool

func IsRPCServerError

func IsRPCServerError(err error) bool

func NewGoRPCClient

func NewGoRPCClient(address string, opts ...RPCClientOption) (adapter.Client, error)

func NewGoRPCServer

func NewGoRPCServer(opts ...RPCServerOption) adapter.Server

Types

type GoRPCClient

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

func (*GoRPCClient) Call

func (g *GoRPCClient) Call(serviceMethod string, args any, reply any) (err error)

func (*GoRPCClient) CallWithConn

func (g *GoRPCClient) CallWithConn(conn io.ReadWriteCloser, serviceMethod string, args any, reply any) error

func (*GoRPCClient) Close

func (g *GoRPCClient) Close() error

func (*GoRPCClient) SetDialer

func (g *GoRPCClient) SetDialer(dialer adapter.DialerFunc)

func (*GoRPCClient) SetRPCServer

func (g *GoRPCClient) SetRPCServer(address string) error

type GoRPCServer

type GoRPCServer struct {
	*rpcgo.Server
	// contains filtered or unexported fields
}

func (*GoRPCServer) Accept

func (s *GoRPCServer) Accept(l net.Listener)

func (*GoRPCServer) AddCert

func (s *GoRPCServer) AddCert(cert []byte)

type PoolOptions

type PoolOptions func(*connPool)

type RPCClientOption

type RPCClientOption func(*GoRPCClient)

func WithCACert

func WithCACert(cert []byte) RPCClientOption

func WithClientCert

func WithClientCert(cert tls.Certificate) RPCClientOption

func WithClientDialer

func WithClientDialer(dialer adapter.DialerFunc) RPCClientOption

func WithClientTLSConfig

func WithClientTLSConfig(c *tls.Config) RPCClientOption

func WithTLSFail

func WithTLSFail(f func()) RPCClientOption

type RPCServerOption

type RPCServerOption func(*GoRPCServer)

func WithClientCA

func WithClientCA(cert []byte) RPCServerOption

func WithServerCert

func WithServerCert(cert tls.Certificate) RPCServerOption

func WithServerFinalizer added in v1.0.2

func WithServerFinalizer(m adapter.ServerFinalizer) RPCServerOption

func WithServerMiddleware added in v1.0.2

func WithServerMiddleware(m adapter.ServerMiddleware) RPCServerOption

func WithTLSConfig

func WithTLSConfig(c *tls.Config) RPCServerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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