-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathconfig.go
49 lines (38 loc) · 877 Bytes
/
config.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package mongonet
import "fmt"
import "github.com/mongodb/slogger/v2/slogger"
type SSLPair struct {
CertFile string
KeyFile string
}
type ProxyConfig struct {
BindHost string
BindPort int
MongoHost string
MongoPort int
MongoSSL bool
UseSSL bool
SSLKeys []SSLPair
LogLevel slogger.Level
Appenders []slogger.Appender
InterceptorFactory ProxyInterceptorFactory
ConnectionPoolHook ConnectionHook
}
func NewProxyConfig(bindHost string, bindPort int, mongoHost string, mongoPort int) ProxyConfig {
return ProxyConfig{
bindHost,
bindPort,
mongoHost,
mongoPort,
false, // MongoSSL
false, // UseSSL
nil,
slogger.OFF, // LogLevel
nil, // Appenders
nil, // InterceptorFactory
nil, // ConnectionPoolHook
}
}
func (pc *ProxyConfig) MongoAddress() string {
return fmt.Sprintf("%s:%d", pc.MongoHost, pc.MongoPort)
}