messages

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BindnodeRegistry = bindnoderegistry.NewRegistry()

BindnodeRegistry is the serialization/deserialization tool for messages

Functions

func WriteForwardingResponseError

func WriteForwardingResponseError(s io.Writer, err error) error

WriteForwardingResponseError sends a routing response with code Rejected and a message containing the error to a io.Writer

func WriteInboundForwardingRequest

func WriteInboundForwardingRequest(s io.Writer, remote peer.ID, protocolID protocol.ID) error

WriteInboundForwardingRequest writes a new inbound forwarding request to a network strema

func WriteOutboundForwardingRequest

func WriteOutboundForwardingRequest(s io.Writer, remote peer.ID, protocols []protocol.ID) error

WriteOutboundForwardingRequest writes a new outbound forwarding request to a network strema

func WriteOutboundForwardingResponseSuccess

func WriteOutboundForwardingResponseSuccess(s io.Writer, remotePubKey crypto.PubKey, protocolID protocol.ID) error

WriteOutboundForwardingResponseSuccess writes a new outbound forwarding success response to a network strema

Types

type ForwardingKind

type ForwardingKind string

ForwardingKind indicates the direction of a forwarding request

const (
	// ForwardingInbound is a forwarding request initiated by the load balancer to a routed peer, requesting
	// forwarding of a public peers traffic inbound the routed peer
	ForwardingInbound ForwardingKind = "Inbound"
	// ForwardingOutbound is a forwarding request initaited by a routed peer to the load balancer requesting forward
	// of traffic outbound to a public peer
	ForwardingOutbound ForwardingKind = "Outbound"
)

type ForwardingRequest

type ForwardingRequest struct {
	Kind      ForwardingKind
	Remote    peer.ID
	Protocols []protocol.ID // Should always be length 1 for Inbound requests
}

ForwardingRequest is a request to forward traffic through the load balancer

func ReadForwardingRequest

func ReadForwardingRequest(s io.Reader) (*ForwardingRequest, error)

ReadForwardingRequest reads a forwarding request from a network stream

type ForwardingResponse

type ForwardingResponse struct {
	Code       ResponseCode
	Message    string // more info if rejected
	ProtocolID *protocol.ID
}

ForwardingResponse is a response to and outbound forwarding request

func ReadForwardingResponse

func ReadForwardingResponse(s io.Reader) (*ForwardingResponse, error)

ReadForwardingResponse reads a forwarding response from a network stream

type ResponseCode

type ResponseCode string

ResponseCode indicates a success or failure on either the register-routing or the forwarding protocols

const (
	// ResponseOk indicates a request was successful
	ResponseOk ResponseCode = "Ok"
	// ResponseRejected indicates something went wrong in the request -- more information is supplied in the Message field
	// of the response
	ResponseRejected ResponseCode = "Rejected"
)

Jump to

Keyboard shortcuts

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