* api/resolver: Resolve options * router/registry: fix init bug * router/registry: fix wildcard query bug * web: fix registation domain bug * registry/etcd: pass domain in service metadata * api/resolver/subdomain: expose domain func * Update api/resolver/subdomain/subdomain.go Co-authored-by: Dominic Wong <domwongemail@googlemail.com> Co-authored-by: Dominic Wong <domwongemail@googlemail.com>
		
			
				
	
	
		
			33 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			644 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Package resolver resolves a http request to an endpoint
 | |
| package resolver
 | |
| 
 | |
| import (
 | |
| 	"errors"
 | |
| 	"net/http"
 | |
| )
 | |
| 
 | |
| var (
 | |
| 	ErrNotFound    = errors.New("not found")
 | |
| 	ErrInvalidPath = errors.New("invalid path")
 | |
| )
 | |
| 
 | |
| // Resolver resolves requests to endpoints
 | |
| type Resolver interface {
 | |
| 	Resolve(r *http.Request, opts ...ResolveOption) (*Endpoint, error)
 | |
| 	String() string
 | |
| }
 | |
| 
 | |
| // Endpoint is the endpoint for a http request
 | |
| type Endpoint struct {
 | |
| 	// e.g greeter
 | |
| 	Name string
 | |
| 	// HTTP Host e.g example.com
 | |
| 	Host string
 | |
| 	// HTTP Methods e.g GET, POST
 | |
| 	Method string
 | |
| 	// HTTP Path e.g /greeter.
 | |
| 	Path string
 | |
| 	// Domain endpoint exists within
 | |
| 	Domain string
 | |
| }
 |