Documentation ¶
Index ¶
- Variables
- type Constructor
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerID() string
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetPeerLinks(peerID peer.ID) []link.Link
- func (c *Controller) GetTransport(ctx context.Context) (transport.Transport, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
- func (c *Controller) HandleIncomingStream(rctx context.Context, lnk link.Link, strm stream.Stream, ...)
- func (c *Controller) HandleLinkEstablished(lnk link.Link)
- func (c *Controller) HandleLinkLost(lnk link.Link)
- func (c *Controller) PushDialer(ctx context.Context, peerID peer.ID, opts *dialer.DialerOpts) error
- func (c *Controller) PushStaticPeer(id string, opts *dialer.DialerOpts)
- func (c *Controller) SetStaticPeerMap(m map[string]*dialer.DialerOpts)
- type StreamEstablish
- func (*StreamEstablish) Descriptor() ([]byte, []int)deprecated
- func (this *StreamEstablish) EqualVT(that *StreamEstablish) bool
- func (x *StreamEstablish) GetProtocolId() string
- func (m *StreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *StreamEstablish) MarshalToVT(dAtA []byte) (int, error)
- func (m *StreamEstablish) MarshalVT() (dAtA []byte, err error)
- func (*StreamEstablish) ProtoMessage()
- func (x *StreamEstablish) ProtoReflect() protoreflect.Message
- func (x *StreamEstablish) Reset()
- func (m *StreamEstablish) SizeVT() (n int)
- func (x *StreamEstablish) String() string
- func (m *StreamEstablish) UnmarshalVT(dAtA []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") )
var File_github_com_aperturerobotics_bifrost_transport_controller_controller_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor func( ctx context.Context, le *logrus.Entry, pkey crypto.PrivKey, handler transport.TransportHandler, ) (transport.Transport, error)
Constructor constructs a transport with common parameters.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements a common transport controller. The controller looks up the Node, acquires its identity, constructs the transport, and manages the lifecycle of dialing and accepting links.
func NewController ¶
func NewController( le *logrus.Entry, bus bus.Bus, nodePeerIDConstraint peer.ID, ctor Constructor, transportID string, transportVersion semver.Version, staticPeerMap map[string]*dialer.DialerOpts, ) *Controller
NewController constructs a new transport controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the transport controller and the transport. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerID ¶
func (c *Controller) GetControllerID() string
GetControllerID returns the controller ID.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetPeerLinks ¶
func (c *Controller) GetPeerLinks(peerID peer.ID) []link.Link
GetPeerLinks returns all links with the peer.
func (*Controller) GetTransport ¶
GetTransport returns the controlled transport. This may be nil until the transport is constructed.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any exceptional errors are returned for logging. It is safe to add a reference to the directive during this call.
func (*Controller) HandleIncomingStream ¶
func (c *Controller) HandleIncomingStream( rctx context.Context, lnk link.Link, strm stream.Stream, strmOpts stream.OpenOpts, )
HandleIncomingStream handles an incoming stream from a link. It negotiates the protocol for the stream, acquires a handler for the protocol, and hands the stream to the protocol handler, then returns. Uses the ctx for cancellation.
rctx is the link Context, which is canceled when the link is closed.
func (*Controller) HandleLinkEstablished ¶
func (c *Controller) HandleLinkEstablished(lnk link.Link)
HandleLinkEstablished is called by the transport when a link is established.
func (*Controller) HandleLinkLost ¶
func (c *Controller) HandleLinkLost(lnk link.Link)
HandleLinkLost is called when a link is lost.
func (*Controller) PushDialer ¶
func (c *Controller) PushDialer( ctx context.Context, peerID peer.ID, opts *dialer.DialerOpts, ) error
PushDialer pushes a new dialer. Waits for the transport to be constructed. If the transport is not a TransportDialer, returns nil. Returns after the dialer is pushed.
func (*Controller) PushStaticPeer ¶
func (c *Controller) PushStaticPeer(id string, opts *dialer.DialerOpts)
PushStaticPeer pushes a static peer dialer.
func (*Controller) SetStaticPeerMap ¶
func (c *Controller) SetStaticPeerMap(m map[string]*dialer.DialerOpts)
SetStaticPeerMap sets the static dialing peer map.
type StreamEstablish ¶
type StreamEstablish struct { // ProtocolID is the protocol identifier string for the stream. ProtocolId string `protobuf:"bytes,1,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` // contains filtered or unexported fields }
StreamEstablish is the first message sent by the initiator of a stream. Prefixed by a uint32 length. Max size: 100kb
func NewStreamEstablish ¶
func NewStreamEstablish(protocolID protocol.ID) *StreamEstablish
NewStreamEstablish constructs a new StreamEstablish message.
func (*StreamEstablish) Descriptor
deprecated
func (*StreamEstablish) Descriptor() ([]byte, []int)
Deprecated: Use StreamEstablish.ProtoReflect.Descriptor instead.
func (*StreamEstablish) EqualVT ¶ added in v0.3.0
func (this *StreamEstablish) EqualVT(that *StreamEstablish) bool
func (*StreamEstablish) GetProtocolId ¶
func (x *StreamEstablish) GetProtocolId() string
func (*StreamEstablish) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *StreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*StreamEstablish) MarshalToVT ¶ added in v0.2.0
func (m *StreamEstablish) MarshalToVT(dAtA []byte) (int, error)
func (*StreamEstablish) MarshalVT ¶ added in v0.2.0
func (m *StreamEstablish) MarshalVT() (dAtA []byte, err error)
func (*StreamEstablish) ProtoMessage ¶
func (*StreamEstablish) ProtoMessage()
func (*StreamEstablish) ProtoReflect ¶ added in v0.2.0
func (x *StreamEstablish) ProtoReflect() protoreflect.Message
func (*StreamEstablish) Reset ¶
func (x *StreamEstablish) Reset()
func (*StreamEstablish) SizeVT ¶ added in v0.2.0
func (m *StreamEstablish) SizeVT() (n int)
func (*StreamEstablish) String ¶
func (x *StreamEstablish) String() string
func (*StreamEstablish) UnmarshalVT ¶ added in v0.2.0
func (m *StreamEstablish) UnmarshalVT(dAtA []byte) error