func (l *FunctionLookup) Resolve(name string) (u url.URL, err error) {
	log.Infof("resolving function %s", name)
	providerURL, err := l.providerLookup.Resolve(name)
	if err != nil {
		return url.URL{}, err
	}
	log.Infof("using provider %s to for function %s", providerURL.String(), name)
	return *providerURL, nil
}
Resolve implements the openfaas-provider proxy.BaseURLResolver interface.
package handlers
import (
	"context"
	"fmt"
	"math/rand"
	"net"
	"net/http"
	"net/url"
	"strings"
	"time"
	"github.com/gorilla/mux"
	"github.com/openfaas-incubator/faas-federation/routing"
	log "github.com/sirupsen/logrus"
)
const urlScheme = "http"
func MakeProxyHandler(proxy http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		log.Info("proxy request")
		pathVars := mux.Vars(r)
		if pathVars == nil {
			r = mux.SetURLVars(r, map[string]string{})
			pathVars = mux.Vars(r)
		}
		functionName := strings.Split(r.URL.Path, "/")[2]
		pathVars["name"] = functionName
		pathVars["params"] = r.URL.Path
		proxy.ServeHTTP(w, r)
		log.Infof("proxy request for function %s path %s", functionName, r.URL.String())
	}
}
type FunctionLookup struct {
	scheme string
	dnsrrLookup    func(context.Context, string) ([]net.IP, error)
	providerLookup routing.ProviderLookup
}
func NewFunctionLookup(providerLookup routing.ProviderLookup) *FunctionLookup {
	return &FunctionLookup{
		scheme:         urlScheme,
		dnsrrLookup:    lookupIP,
		providerLookup: providerLookup,
	}
}