Don Newton | 379ae25 | 2019-04-01 12:17:06 -0400 | [diff] [blame^] | 1 | // 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 | |
| 7 | package connection |
| 8 | |
| 9 | import "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. |
| 20 | type Proxy struct { |
| 21 | Processor wiremessage.Transformer |
| 22 | Pool Pool |
| 23 | } |
| 24 | |
| 25 | // HandleConnection implements the Handler interface. |
| 26 | func (*Proxy) HandleConnection(Connection) { return } |