contact

package
v1.92.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is the default error class for contact package.
	Error = errs.Class("contact")
)

Functions

This section is empty.

Types

type Config added in v0.22.0

type Config struct {
	ExternalAddress string        `user:"true" help:"the public address of the node, useful for nodes behind NAT" default:""`
	Timeout         time.Duration `help:"timeout for pinging storage nodes" default:"10m0s" testDefault:"1m"`
	AllowPrivateIP  bool          `help:"allow private IPs in CheckIn and PingMe" testDefault:"true" devDefault:"true" default:"false"`

	RateLimitInterval  time.Duration `help:"the amount of time that should happen between contact attempts usually" releaseDefault:"10m0s" devDefault:"1ns"`
	RateLimitBurst     int           `help:"the maximum burst size for the contact rate limit token bucket" releaseDefault:"2" devDefault:"1000"`
	RateLimitCacheSize int           `help:"the number of nodes or addresses to keep token buckets for" default:"1000"`
}

Config contains configurable values for contact service.

type Endpoint

type Endpoint struct {
	pb.DRPCNodeUnimplementedServer
	// contains filtered or unexported fields
}

Endpoint implements the contact service Endpoints.

func NewEndpoint

func NewEndpoint(log *zap.Logger, service *Service) *Endpoint

NewEndpoint returns a new contact service endpoint.

func (*Endpoint) CheckIn

func (endpoint *Endpoint) CheckIn(ctx context.Context, req *pb.CheckInRequest) (_ *pb.CheckInResponse, err error)

CheckIn is periodically called by storage nodes to keep the satellite informed of its existence, address, and operator information. In return, this satellite keeps the node informed of its reachability. When a node checks-in with the satellite, the satellite pings the node back to confirm they can successfully connect.

func (*Endpoint) GetTime added in v0.30.0

func (endpoint *Endpoint) GetTime(ctx context.Context, req *pb.GetTimeRequest) (_ *pb.GetTimeResponse, err error)

GetTime returns current timestamp.

func (*Endpoint) PingMe added in v1.47.3

func (endpoint *Endpoint) PingMe(ctx context.Context, req *pb.PingMeRequest) (_ *pb.PingMeResponse, err error)

PingMe is called by storage node to request a pingBack from the satellite to confirm they can successfully connect to the node.

type RateLimiter added in v1.29.4

type RateLimiter struct {
	// contains filtered or unexported fields
}

RateLimiter allows to prevent multiple events in fixed period of time.

func NewRateLimiter added in v1.29.4

func NewRateLimiter(interval time.Duration, burst, numLimits int) *RateLimiter

NewRateLimiter is a constructor for RateLimiter.

func (*RateLimiter) IsAllowed added in v1.29.4

func (rateLimiter *RateLimiter) IsAllowed(ctx context.Context, key string) bool

IsAllowed indicates if event is allowed to happen.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the contact service between storage nodes and satellites. It is responsible for updating general node information like address and capacity. It is also responsible for updating peer identity information for verifying signatures from that node.

architecture: Service

func NewService

func NewService(log *zap.Logger, overlay *overlay.Service, peerIDs overlay.PeerIdentities, dialer rpc.Dialer, authority nodetag.Authority, config Config) *Service

NewService creates a new contact service.

func (*Service) Close added in v0.22.0

func (service *Service) Close() error

Close closes resources.

func (*Service) PingBack added in v0.29.0

func (service *Service) PingBack(ctx context.Context, nodeurl storj.NodeURL) (_ bool, _ bool, _ string, err error)

PingBack pings the node to test connectivity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL