grpc_dialer

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeepAliveTime 在此时间后客户端没看到任何活动,将ping服务器
	KeepAliveTime = time.Duration(30) * time.Minute

	// KeepAliveTimeout 客户端在ping以后等待的时间
	KeepAliveTimeout = time.Duration(20) * time.Second
)

Variables

View Source
var Conn = map[string]*grpc.ClientConn{}
View Source
var DefaultDialOptions = []grpc.DialOption{
	grpc.WithKeepaliveParams(keepalive.ClientParameters{
		Time:                KeepAliveTime,
		Timeout:             KeepAliveTimeout,
		PermitWithoutStream: true,
	}),
}

Functions

func Call

func Call(md grpc_service.Metadata, cb func(*grpc.ClientConn) error) error

func DialContext

func DialContext(ctx context.Context, opts []grpc.DialOption, scheme string, mds ...grpc_service.Metadata) error

DialContext 根据metadata构建链接池

func DialContextConn added in v0.2.9

func DialContextConn(conn *grpc.ClientConn, mds ...grpc_service.Metadata) error

func DialContextConnection added in v0.2.15

func DialContextConnection(ctx context.Context, opts []grpc.DialOption, scheme string, md grpc_service.Metadata) (*grpc.ClientConn, error)

DialContextConnection 根据metadata构建单个链接

func DialContextEndpoint added in v0.2.5

func DialContextEndpoint(ctx context.Context, opts []grpc.DialOption, endpoint string, mds ...grpc_service.Metadata) error

DialContextEndpoint 使用固定端点构建链接池

func DialContextEndpointConnection added in v0.2.15

func DialContextEndpointConnection(ctx context.Context, opts []grpc.DialOption, endpoint string) (*grpc.ClientConn, error)

DialContextEndpointConnection 使用固定端点构建链接

Types

type GrpcDialer added in v0.2.9

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

func NewGrpcDialer added in v0.2.9

func NewGrpcDialer(
	endpoints map[string]string,
	metadataInfo map[string][]grpc_service.Metadata,
	opt []grpc.DialOption) *GrpcDialer

func (*GrpcDialer) Run added in v0.2.9

func (g *GrpcDialer) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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