conn

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 17 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_conn_conn_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AddrDialFunc

type AddrDialFunc func(ctx context.Context, addr string) (io.ReadWriteCloser, net.Addr, error)

AddrDialFunc dials an address.

type Link = transport_quic.Link

Link is a Quic-based connection/link backed by a reliable Conn.

type Opts

type Opts struct {

	// Quic are the quic protocol options.
	Quic *quic.Opts `protobuf:"bytes,1,opt,name=quic,proto3" json:"quic,omitempty"`
	// Verbose turns on verbose debug logging.
	Verbose bool `protobuf:"varint,2,opt,name=verbose,proto3" json:"verbose,omitempty"`
	// Mtu sets the maximum size for a single packet.
	// Defaults to 65000.
	Mtu uint32 `protobuf:"varint,3,opt,name=mtu,proto3" json:"mtu,omitempty"`
	// BufSize is the number of packets to buffer.
	//
	// Total memory cap is mtu * bufSize.
	// Defaults to 10.
	BufSize uint32 `protobuf:"varint,4,opt,name=buf_size,json=bufSize,proto3" json:"buf_size,omitempty"`
	// contains filtered or unexported fields
}

Opts are extra options for the reliable conn.

func (*Opts) CloneMessageVT added in v0.15.6

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

func (*Opts) CloneVT added in v0.8.3

func (m *Opts) CloneVT() *Opts

func (*Opts) Descriptor deprecated

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

Deprecated: Use Opts.ProtoReflect.Descriptor instead.

func (*Opts) EqualMessageVT added in v0.15.6

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

func (*Opts) EqualVT added in v0.3.0

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

func (*Opts) GetBufSize

func (x *Opts) GetBufSize() uint32

func (*Opts) GetMtu

func (x *Opts) GetMtu() uint32

func (*Opts) GetQuic

func (x *Opts) GetQuic() *quic.Opts

func (*Opts) GetVerbose

func (x *Opts) GetVerbose() bool

func (*Opts) MarshalToSizedBufferVT added in v0.2.0

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

func (*Opts) MarshalToVT added in v0.2.0

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

func (*Opts) MarshalVT added in v0.2.0

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

func (*Opts) ProtoMessage

func (*Opts) ProtoMessage()

func (*Opts) ProtoReflect added in v0.2.0

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

func (*Opts) Reset

func (x *Opts) Reset()

func (*Opts) SizeVT added in v0.2.0

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

func (*Opts) String

func (x *Opts) String() string

func (*Opts) UnmarshalVT added in v0.2.0

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

type Transport

type Transport struct {
	// Transport is the underlying quic transport
	*transport_quic.Transport
	// contains filtered or unexported fields
}

Transport implements a Bifrost transport with reliable conns.

An example is a TCP connection: the OS provides an ordered stream of data as the interface for the Go program to use.

func NewTransport

func NewTransport(
	ctx context.Context,
	le *logrus.Entry,
	privKey crypto.PrivKey,
	tc transport.TransportHandler,
	opts *Opts,

	uuid uint64,

	laddr net.Addr,

	addrDialer AddrDialFunc,
) (*Transport, error)

NewTransport constructs a new conn-backed transport.

addrDialer is an optional function to enable dialing out.

func (*Transport) HandleConn

func (t *Transport) HandleConn(
	ctx context.Context,
	dial bool,
	c io.ReadWriteCloser,
	raddr net.Addr,
	peerID peer.ID,
) (*Link, error)

HandleConn handles an incoming or outgoing connection.

dial indicates if this is the originator (outgoing) conn or not ctx is used for the negotiation phase only if peerID is empty, allows any peer ID on the other end raddr can be nil if peerID is NOT empty

Jump to

Keyboard shortcuts

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