mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
Add proxy string method
This commit is contained in:
parent
303adca500
commit
1ea6390eae
@ -136,6 +136,10 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Proxy) String() string {
|
||||
return "grpc"
|
||||
}
|
||||
|
||||
// NewProxy returns a new grpc proxy server
|
||||
func NewProxy(opts ...proxy.Option) proxy.Proxy {
|
||||
var options proxy.Options
|
||||
|
@ -188,6 +188,10 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Proxy) String() string {
|
||||
return "http"
|
||||
}
|
||||
|
||||
// NewSingleHostProxy returns a router which sends requests to a single http backend
|
||||
func NewSingleHostProxy(url string) proxy.Proxy {
|
||||
return &Proxy{
|
||||
|
@ -521,6 +521,10 @@ func (p *Proxy) serveRequest(ctx context.Context, link client.Client, service, e
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Proxy) String() string {
|
||||
return "mucp"
|
||||
}
|
||||
|
||||
// NewSingleHostProxy returns a proxy which sends requests to a single backend
|
||||
func NewSingleHostProxy(endpoint string) *Proxy {
|
||||
return &Proxy{
|
||||
|
@ -13,6 +13,8 @@ type Proxy interface {
|
||||
ProcessMessage(context.Context, server.Message) error
|
||||
// ServeRequest handles inbound requests
|
||||
ServeRequest(context.Context, server.Request, server.Response) error
|
||||
// Name of the proxy protocol
|
||||
String() string
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user