discover

package
v3.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package discover implements a gRPC discovery middleware.

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPPorts = map[bool]int{
	// contains filtered or unexported fields
}

DefaultHTTPPorts is a map of the default HTTP ports, with/without TLS.

View Source
var DefaultPorts = map[bool]int{
	// contains filtered or unexported fields
}

DefaultPorts is a map of the default gRPC ports, with/without TLS.

View Source
var HTTPScheme = map[bool]string{
	// contains filtered or unexported fields
}

HTTPScheme is a map of the HTTP schemes, with/without TLS.

Functions

func DefaultPort

func DefaultPort(target string, port int) (string, error)

DefaultPort appends port if target does not already have one.

func DefaultURL

func DefaultURL(target string, port int, tls bool) (string, error)

DefaultURL appends protocol and port if target does not already have one.

func DialContext

func DialContext(ctx context.Context, target string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)

DialContext creates a client connection to the given target. It uses DialOptions to discover gRPC dial options for the target.

func DialOptions

func DialOptions(ctx context.Context, target string, creds credentials.TransportCredentials) ([]grpc.DialOption, error)

DialOptions discovers gRPC dial options based on the given target. This includes whether or not transport level security is enabled and service port discovery.

func WithInsecure

func WithInsecure() []grpc.DialOption

WithInsecure returns gRPC dial options which disable transport security and discover the default insecure listen port if not specified in the dial target.

func WithTLSFallback

func WithTLSFallback(parent context.Context, tls bool) context.Context

WithTLSFallback returns a derived context which is configured to fall back to the given TLS setting if discovery fails.

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) []grpc.DialOption

WithTransportCredentials returns gRPC dial options which configures connection level security credentials (e.g., TLS/SSL) and discover the TLS/SSL listen port if not specified in the dial target.

Types

This section is empty.

Jump to

Keyboard shortcuts

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