tcp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tcp contains a tcp implementation of the messenger, it can be used for AS internal traffic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	TopologyProvider topology.Provider
}

Client is the client side of the messenger.

func (Client) Request

func (c Client) Request(ctx context.Context, pld *ctrl.Pld, address net.Addr) (*ctrl.Pld, error)

Request sends the request pld to the given address and returns the reply.

type Messenger

type Messenger struct {
	// Addr is the listening address.
	Addr *net.TCPAddr
	// Handler is used to handle RPCs.
	Handler *messenger.QUICHandler
	// Client is used to request data from a remote.
	Client *Client
	// contains filtered or unexported fields
}

Messenger implements an intra-AS TCP messenger. Note that not all functionality is implemented.

func NewClientMessenger

func NewClientMessenger(client Client) *Messenger

NewClientMessenger creates a client messenger.

func NewServerMessenger

func NewServerMessenger(listen *net.TCPAddr) *Messenger

NewServerMessenger creates a TCP messenger with the given listen address. Note that only when calling `ListenAndServe` the messenger will actually handle requests.

func (*Messenger) AddHandler

func (m *Messenger) AddHandler(msgType infra.MessageType, h infra.Handler)

func (*Messenger) CloseServer

func (m *Messenger) CloseServer() error

func (*Messenger) GetCertChain

func (m *Messenger) GetCertChain(ctx context.Context, msg *cert_mgmt.ChainReq, a net.Addr,
	id uint64) (*cert_mgmt.Chain, error)

GetCertChain sends a cert_mgmt.ChainReq to address a, blocks until it receives a reply and returns the reply.

func (*Messenger) GetSegs

func (m *Messenger) GetSegs(ctx context.Context, msg *path_mgmt.SegReq, a net.Addr,
	id uint64) (*path_mgmt.SegReply, error)

GetSegs asks the server at the remote address for the path segments that satisfy msg, and returns a verified reply.

func (*Messenger) GetTRC

func (m *Messenger) GetTRC(ctx context.Context, msg *cert_mgmt.TRCReq, a net.Addr,
	id uint64) (*cert_mgmt.TRC, error)

GetTRC sends a cert_mgmt.TRCReq request to address a, blocks until it receives a reply and returns the reply.

func (*Messenger) ListenAndServe

func (m *Messenger) ListenAndServe()

func (*Messenger) SendAck

func (m *Messenger) SendAck(ctx context.Context, msg *ack.Ack, a net.Addr, id uint64) error

func (*Messenger) SendCertChain

func (m *Messenger) SendCertChain(ctx context.Context, msg *cert_mgmt.Chain, a net.Addr,
	id uint64) error

SendCertChain sends a reliable cert_mgmt.Chain to address a.

func (*Messenger) SendTRC

func (m *Messenger) SendTRC(ctx context.Context, msg *cert_mgmt.TRC, a net.Addr, id uint64) error

SendTRC sends a reliable cert_mgmt.TRC to address a.

Jump to

Keyboard shortcuts

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