Documentation ¶
Index ¶
- func Insecure(address string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func Internal(endpoint Endpoint, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func Local(address, clientID, clientSecret string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func OAuthToken(address, clientID, clientSecret string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func Remote(address RemoteAddress, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func WithBearer(bearer string) grpc.DialOption
- type Endpoint
- type RemoteAddress
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
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