func (p *EnvoyProxy) WithClient(fn func(c shimrpc.RegistrarClient) error) error {
	conn, err := grpc.Dial(p.ServerAddr,
		grpc.WithInsecure(),
		grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
			log.Debugf("Connecting on Unix socket: %s", addr)
			return net.DialTimeout("unix", addr, timeout)
		}),
		grpc.WithTimeout(p.GRPCTimeout),
		grpc.FailOnNonTempDialError(true),
	)
	if err != nil {
		return err
	}
	c := shimrpc.NewRegistrarClient(conn)
	err = fn(c)
	conn.Close()
	return err
}
WithClient is a wrapper to make a new connection and close it with each call.
We should have extremely low throughput so this provides a level of safety by
reconnection each time.
package main
import (
	"net"
	"time"
	"github.com/Nitro/envoy-docker-shim/internal/shimrpc"
	log "github.com/sirupsen/logrus"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
)
const (
	ServiceNameLabel     = "ServiceName"
	EnvironmentNameLabel = "EnvironmentName"
	ProxyModeLabel       = "ProxyMode"
)
type EnvoyProxy struct {
	ServerAddr   string
	frontendAddr *net.TCPAddr
	backendAddr  *net.TCPAddr
	Discoverer   DiscoveryClient
	Reload       bool  
	Retries      []int
	GRPCTimeout  time.Duration
}
func NewEnvoyProxy(frontendAddr, backendAddr net.Addr, svrAddr string) (*EnvoyProxy, error) {
	front := frontendAddr.(*net.TCPAddr)
	back := backendAddr.(*net.TCPAddr)
	return &EnvoyProxy{
		frontendAddr: front,
		backendAddr:  back,
		ServerAddr:   svrAddr,
		Discoverer:   &DockerClient{},
		Retries:      []int{100, 500, 1000, 1500},
		GRPCTimeout:  3 * time.Second,
	}, nil
}