blob: 62e18d22c09dddd9da1ed2358b6a16f46dc01e44 [file] [log] [blame]
Don Newton379ae252019-04-01 12:17:06 -04001// Copyright (C) MongoDB, Inc. 2017-present.
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may
4// not use this file except in compliance with the License. You may obtain
5// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
7package connection
8
9import "github.com/mongodb/mongo-go-driver/x/network/wiremessage"
10
11// Proxy implements a MongoDB proxy. It will use the given pool to connect to a
12// MongoDB server and proxy the traffic between connections it is given and the
13// server. It will pass each of the wireops it reads from the handled connection
14// to a Processor. If an error is returned from the processor, the wireop will
15// not be forwarded onto the server. If there is not an error the returned message
16// will be passed onto the server. If both the return message and the error are nil,
17// the original wiremessage will be passed onto the server.
18//
19// TODO(GODRIVER-268): Implement this.
20type Proxy struct {
21 Processor wiremessage.Transformer
22 Pool Pool
23}
24
25// HandleConnection implements the Handler interface.
26func (*Proxy) HandleConnection(Connection) { return }