dialer

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Dialer

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

Dialer manages a transport dialer.

func NewDialer

func NewDialer(
	le *logrus.Entry,
	tptDialer TransportDialer,
	opts *DialerOpts,
	peerID peer.ID,
	address string,
) *Dialer

NewDialer constructs a new Dialer

func (*Dialer) Execute

func (d *Dialer) Execute(ctx context.Context) error

Execute executes the dialer, with backoff.

type DialerOpts

type DialerOpts struct {

	// Address is the address of the peer, in the format expected by the transport.
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// Backoff is the dialing backoff configuration.
	// Can be empty.
	Backoff *backoff.Backoff `protobuf:"bytes,2,opt,name=backoff,proto3" json:"backoff,omitempty"`
	// contains filtered or unexported fields
}

DialerOpts contains options relating to dialing a statically configured peer.

func (*DialerOpts) CloneMessageVT added in v0.15.6

func (m *DialerOpts) CloneMessageVT() proto.Message

func (*DialerOpts) CloneVT added in v0.8.3

func (m *DialerOpts) CloneVT() *DialerOpts

func (*DialerOpts) Descriptor deprecated

func (*DialerOpts) Descriptor() ([]byte, []int)

Deprecated: Use DialerOpts.ProtoReflect.Descriptor instead.

func (*DialerOpts) EqualMessageVT added in v0.15.6

func (this *DialerOpts) EqualMessageVT(thatMsg proto.Message) bool

func (*DialerOpts) EqualVT added in v0.3.0

func (this *DialerOpts) EqualVT(that *DialerOpts) bool

func (*DialerOpts) GetAddress

func (x *DialerOpts) GetAddress() string

func (*DialerOpts) GetBackoff

func (x *DialerOpts) GetBackoff() *backoff.Backoff

func (*DialerOpts) MarshalToSizedBufferVT added in v0.2.0

func (m *DialerOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DialerOpts) MarshalToVT added in v0.2.0

func (m *DialerOpts) MarshalToVT(dAtA []byte) (int, error)

func (*DialerOpts) MarshalVT added in v0.2.0

func (m *DialerOpts) MarshalVT() (dAtA []byte, err error)

func (*DialerOpts) ProtoMessage

func (*DialerOpts) ProtoMessage()

func (*DialerOpts) ProtoReflect added in v0.2.0

func (x *DialerOpts) ProtoReflect() protoreflect.Message

func (*DialerOpts) Reset

func (x *DialerOpts) Reset()

func (*DialerOpts) SizeVT added in v0.2.0

func (m *DialerOpts) SizeVT() (n int)

func (*DialerOpts) String

func (x *DialerOpts) String() string

func (*DialerOpts) UnmarshalVT added in v0.2.0

func (m *DialerOpts) UnmarshalVT(dAtA []byte) error

type TransportDialer added in v0.21.0

type TransportDialer interface {
	// MatchTransportType checks if the given transport type ID matches this transport.
	// If returns true, the transport controller will call DialPeer with that tptaddr.
	// E.x.: "udp-quic" or "ws"
	MatchTransportType(transportType string) bool

	// GetPeerDialer returns the dialing information for a peer.
	// Called when resolving EstablishLink.
	// Return nil, nil to indicate not found or unavailable.
	GetPeerDialer(
		ctx context.Context,
		peerID peer.ID,
	) (*DialerOpts, error)

	// DialPeer dials a peer given an address. The yielded link should be
	// emitted to the transport handler. DialPeer should return nil if the link
	// was established. DialPeer will then not be called again for the same peer
	// ID and address tuple until the yielded link is lost.
	// Returns fatal and error.
	DialPeer(
		ctx context.Context,
		peerID peer.ID,
		addr string,
	) (fatal bool, err error)
}

TransportDialer is a transport that supports dialing string-serialized remote addresses. The Transport controller will call Dial if provided an address for the transport, and directed to connect to the peer.

Jump to

Keyboard shortcuts

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