connect

package
v1.53.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 12 Imported by: 1

README

connect

GoDoc

Package connect has GRPC connections utils.

Install
import (
	"libs.altipla.consulting/connect"
)
Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

Running tests

Run the tests:

make test
License

MIT License

Documentation

Overview

Package connect has GRPC connections utils.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Insecure

func Insecure(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

Insecure opens an insecure local connection to debug in the dev machines. Unsuitable for production because everything would have to be in the same Kubernetes cluster.

func Internal added in v1.15.0

func Internal(endpoint Endpoint, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func Local

func Local(address, clientID, clientSecret string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

Local opens a connection to the nearest endpoint. In development it uses an insecure local channel and in production it uses the client credentials to request an OAuth2 token from BeAuth.io and authenticates every request with it.

func OAuthToken

func OAuthToken(address, clientID, clientSecret string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

OAuthToken opens a connection using OAuth2 tokens obtained from BeAuth.io users or clients.

func Remote added in v1.15.0

func Remote(address RemoteAddress, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func WithBearer added in v1.15.0

func WithBearer(bearer string) grpc.DialOption

func WithContextClearAuto added in v1.53.0

func WithContextClearAuto(ctx context.Context, headers ...string) context.Context

Types

type Endpoint added in v1.15.0

type Endpoint string

Endpoint is a simple string with the host and port of the remote GRPC service. We use a custom type to avoid using grpc.Dial without noticing the bug.

This needs a "discovery" package with the full list of remote addresses that use this type instead of string and never using the direct address. That way if you use grpc.Dial it will report the compilation error inmediatly.

type RemoteAddress added in v1.15.0

type RemoteAddress string

Jump to

Keyboard shortcuts

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