Categorygithub.com/nvx/grpc-consul-resolver
modulepackage
1.4.0
Repository: https://github.com/nvx/grpc-consul-resolver.git
Documentation: pkg.go.dev

# README

GitHub release Go Report Card GoDoc

gRPC Consul resolver

This lib resolves Consul services by name.

Usage

Somewhere in your init code:

import (
    "github.com/nvx/grpc-consul-resolver"
)

// Will query consul every 5 seconds.
resolver.RegisterDefault(time.Second * 5)

Getting connection:

conn, err := grpc.DialContext(ctx, "consul://service/my-awesome-service")

Using a tag

conn, err := grpc.DialContext(ctx, "consul://service/my-awesome-service/http")

Using a prepared query

conn, err := grpc.DialContext(ctx, "consul://query/my-awesome-query")

With round-robin balancer:

import (
    "google.golang.org/grpc/balancer/roundrobin"
)

conn, err := grpc.DialContext(ctx, "consul://service/my-awesome-service", grpc.WithBalancerName(roundrobin.Name))

# Functions

No description provided by the author

# Constants

No description provided by the author

# Structs

No description provided by the author
No description provided by the author