2020-11-23 16:18:47 +03:00
|
|
|
// Package proxy is a transparent proxy built on the micro/server
|
2019-06-06 09:50:25 +01:00
|
|
|
package proxy
|
|
|
|
|
2019-06-06 17:49:41 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-08-19 17:47:17 +03:00
|
|
|
"github.com/unistack-org/micro/v3/server"
|
2019-06-06 17:49:41 +01:00
|
|
|
)
|
|
|
|
|
2021-02-14 16:16:01 +03:00
|
|
|
var (
|
|
|
|
// DefaultEndpoint holds default proxy address
|
|
|
|
DefaultEndpoint = "localhost:9090"
|
|
|
|
)
|
|
|
|
|
2020-11-23 16:18:47 +03:00
|
|
|
// Proxy can be used as a proxy server for micro services
|
2019-06-06 17:49:41 +01:00
|
|
|
type Proxy interface {
|
2019-11-25 16:31:43 +00:00
|
|
|
// ProcessMessage handles inbound messages
|
|
|
|
ProcessMessage(context.Context, server.Message) error
|
|
|
|
// ServeRequest handles inbound requests
|
2019-06-06 17:58:21 +01:00
|
|
|
ServeRequest(context.Context, server.Request, server.Response) error
|
2019-12-16 15:18:20 +00:00
|
|
|
// Name of the proxy protocol
|
|
|
|
String() string
|
2019-06-06 17:49:41 +01:00
|
|
|
}
|