Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config encapsulates the required configuration options for spinning up a mongo proxy instance.
func NewConfig ¶
func NewConfig(opts ...ConfigOption) (*Config, error)
NewConfig creates a new proxy configuration and applies the provided options.
type ConfigOption ¶
ConfigOption applies a configuration setting to a Config instance.
func WithListenAddress ¶
func WithListenAddress(addr string) ConfigOption
WithListenAddress specifies the address where the proxy listens for incoming client connections.
func WithLogger ¶
func WithLogger(logger *logrus.Entry) ConfigOption
WithLogger configures the proxy server to use the specified logger.
func WithRequestHandler ¶
func WithRequestHandler(handler RequestHandler) ConfigOption
WithRequestHandler specifies the handler that will be invoked to process incoming client requests.
func WithTLS ¶
func WithTLS(tlsConfig *tls.Config) ConfigOption
WithTLS enables TLS mode for incoming client connections using the specified TLS configuration settings.
type RequestHandler ¶
type RequestHandler interface { // HandleRequest processes the incoming request and writes a response // using the mongo wire format back to the provided io.Writer. HandleRequest(clientID string, w io.Writer, r []byte) error // RemoveClient is invoked when the remote mongo client disconnects. RemoveClient(clientID string) error }
RequestHandler is implemented by objects that process incoming requests from mongo clients.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements a proxy server that buffers incoming mongo requests and passes them to a user-defined handler for further processing.