frostfs-node/cmd/neofs-node/modules/network/peers.go

29 lines
750 B
Go
Raw Normal View History

package network
import (
"github.com/multiformats/go-multiaddr"
2020-07-24 13:54:03 +00:00
"github.com/nspcc-dev/neofs-node/pkg/network/peers"
"github.com/spf13/viper"
"go.uber.org/dig"
"go.uber.org/zap"
)
type peersParams struct {
dig.In
2020-07-24 13:54:03 +00:00
Viper *viper.Viper
Logger *zap.Logger
Address multiaddr.Multiaddr
}
func newPeers(p peersParams) (peers.Interface, error) {
return peers.New(peers.Params{
Logger: p.Logger,
ConnectionTTL: p.Viper.GetDuration("peers.connections_ttl"),
ConnectionIDLE: p.Viper.GetDuration("peers.connections_idle"),
MetricsTimeout: p.Viper.GetDuration("peers.metrics_timeout"),
KeepAliveTTL: p.Viper.GetDuration("peers.keep_alive.ttl"),
KeepAlivePingTTL: p.Viper.GetDuration("peers.keep_alive.ping"),
})
}