dialer

package
v0.30.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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() protobuf_go_lite.CloneMessage

func (*DialerOpts) CloneVT added in v0.8.3

func (m *DialerOpts) CloneVT() *DialerOpts

func (*DialerOpts) EqualMessageVT added in v0.15.6

func (this *DialerOpts) EqualMessageVT(thatMsg any) 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) MarshalJSON added in v0.29.0

func (x *DialerOpts) MarshalJSON() ([]byte, error)

MarshalJSON marshals the DialerOpts to JSON.

func (*DialerOpts) MarshalProtoJSON added in v0.29.0

func (x *DialerOpts) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the DialerOpts message to JSON.

func (*DialerOpts) MarshalProtoText added in v0.29.2

func (x *DialerOpts) MarshalProtoText() string

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) 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) UnmarshalJSON added in v0.29.0

func (x *DialerOpts) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the DialerOpts from JSON.

func (*DialerOpts) UnmarshalProtoJSON added in v0.29.0

func (x *DialerOpts) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the DialerOpts message from JSON.

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