gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/api/resolver/resolver.go (about)

     1  // Package resolver resolves a http request to an endpoint
     2  package resolver
     3  
     4  import (
     5  	"net/http"
     6  )
     7  
     8  // Resolver resolves requests to endpoints
     9  type Resolver interface {
    10  	Resolve(r *http.Request) (*Endpoint, error)
    11  	String() string
    12  }
    13  
    14  // Endpoint is the endpoint for a http request
    15  type Endpoint struct {
    16  	// e.g greeter
    17  	Name string
    18  	// HTTP Host e.g example.com
    19  	Host string
    20  	// HTTP Methods e.g GET, POST
    21  	Method string
    22  	// HTTP Path e.g /greeter.
    23  	Path string
    24  }
    25  
    26  type Options struct {
    27  	Handler   string
    28  	Namespace string
    29  }
    30  
    31  type Option func(o *Options)