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