mirror of
https://github.com/hanzozt/sdk-golang.git
synced 2026-10-30 14:46:37 +00:00
- Repo names: ziti-* → zt-* - Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt - Docker images: hanzozt/ziti-* → hanzozt/zt-* - C/Java/JS symbols: ziti_* → zt_* - File and directory names updated
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package zt
|
|
|
|
import (
|
|
"github.com/hanzozt/metrics"
|
|
"github.com/hanzozt/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.NewPayloadIngesterWithConfig(5, 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
|
|
}
|