-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathxg_env.go
39 lines (31 loc) · 1.04 KB
/
xg_env.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
package ziti
import (
"github.com/openziti/metrics"
"github.com/openziti/sdk-golang/xgress"
)
type xgEnv struct {
retransmitter *xgress.Retransmitter
payloadIngester *xgress.PayloadIngester
metrics xgress.Metrics
}
func NewXgressEnv(closeNotify <-chan struct{}, registry metrics.Registry) xgress.Env {
return &xgEnv{
retransmitter: xgress.NewRetransmitter(dummyRetransmitterFaultReporter{}, registry, closeNotify),
payloadIngester: xgress.NewPayloadIngester(closeNotify),
metrics: xgress.NewMetrics(registry),
}
}
func (x xgEnv) GetRetransmitter() *xgress.Retransmitter {
return x.retransmitter
}
func (x xgEnv) GetPayloadIngester() *xgress.PayloadIngester {
return x.payloadIngester
}
func (x xgEnv) GetMetrics() xgress.Metrics {
return x.metrics
}
type dummyRetransmitterFaultReporter struct{}
func (d dummyRetransmitterFaultReporter) ReportForwardingFault(circuitId string, ctrlId string) {
// the only way to get a fault is if the connection goes down, in which case the circuit will
// get torn down anyway
}