2020-07-10 14:17:51 +00:00
|
|
|
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"
|
2020-07-10 14:17:51 +00:00
|
|
|
"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
|
2020-07-10 14:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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"),
|
|
|
|
})
|
|
|
|
}
|