fix proxy protocol

This commit is contained in:
ginuerzh
2022-09-28 11:47:56 +08:00
parent cf20abf656
commit a1255e52d8
41 changed files with 524 additions and 180 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/go-gost/core/logger"
"github.com/go-gost/core/metrics"
"github.com/go-gost/core/selector"
xmetrics "github.com/go-gost/x/metrics"
)
type RouteOptions struct {
@ -124,7 +125,7 @@ func (r *route) connect(ctx context.Context, logger logger.Logger) (conn net.Con
if marker != nil {
marker.Mark()
}
if v := metrics.GetCounter(metrics.MetricChainErrorsCounter,
if v := xmetrics.GetCounter(xmetrics.MetricChainErrorsCounter,
metrics.Labels{"chain": name, "node": node.Name}); v != nil {
v.Inc()
}
@ -171,7 +172,7 @@ func (r *route) connect(ctx context.Context, logger logger.Logger) (conn net.Con
if cn, _ := r.options.Chain.(chainNamer); cn != nil {
name = cn.Name()
}
if v := metrics.GetObserver(metrics.MetricNodeConnectDurationObserver,
if v := xmetrics.GetObserver(xmetrics.MetricNodeConnectDurationObserver,
metrics.Labels{"chain": name, "node": node.Name}); v != nil {
v.Observe(time.Since(start).Seconds())
}