Documentation ¶
Index ¶
- Constants
- Variables
- func DecodePayload(payload *Payload) ([]byte, bool)
- func GlobalRegistry() *registry
- func InitAcker(forwarder PayloadBufferForwarder, metrics metrics.Registry, ...)
- func InitMetrics(registry metrics.UsageRegistry)
- func InitPayloadIngester(closeNotify <-chan struct{})
- func InitRetransmitter(forwarder PayloadBufferForwarder, faultReporter RetransmitterFaultReporter, ...)
- func NewRegistry() *registry
- func ReadUntil(peer transport.Connection, stop byte) ([]byte, error)
- func ReadUntilNewline(peer transport.Connection) ([]byte, error)
- func RemoveTerminator(ctrl CtrlChannel, terminatorId string) error
- func RespondToTraceRequest(headers channel2.Headers, hopType, hopId string, response ControlReceiver)
- func SendRequest(request *Request, peer io.Writer) error
- func SendResponse(response *Response, peer io.Writer) error
- func SetOriginatorFlag(flags uint32, originator Originator) uint32
- type Acker
- type Acknowledgement
- type Address
- type BindHandler
- type Channel2Decoder
- type CircuitInfo
- type CloseHandler
- type CloseHandlerF
- type CloseHelper
- type Connection
- type Control
- func (self *Control) CreateTraceResponse(hopType, hopId string) *Control
- func (self *Control) DecrementAndGetHop() uint32
- func (self *Control) GetLoggerFields() logrus.Fields
- func (self *Control) IsTypeTraceRoute() bool
- func (self *Control) IsTypeTraceRouteResponse() bool
- func (self *Control) Marshall() *channel2.Message
- type ControlReceiver
- type ControlType
- type CtrlChannel
- type Decoder
- type Dialer
- type Factory
- type Header
- type LinkReceiveBuffer
- type LinkSendBuffer
- type Listener
- type Options
- type OptionsData
- type Originator
- type Payload
- type PayloadBufferForwarder
- type PayloadFlag
- type PayloadIngester
- type PeekHandler
- type ReceiveHandler
- type Request
- type Response
- type Retransmitter
- type RetransmitterFaultReporter
- type Xgress
- func (self *Xgress) AddCloseHandler(closeHandler CloseHandler)
- func (self *Xgress) AddPeekHandler(peekHandler PeekHandler)
- func (self *Xgress) Address() Address
- func (self *Xgress) CircuitId() string
- func (self *Xgress) Close()
- func (self *Xgress) CloseTimeout(duration time.Duration)
- func (self *Xgress) Closed() bool
- func (self *Xgress) ForwardEndOfCircuit(sendF func(payload *Payload) bool)
- func (self *Xgress) GetEndCircuit() *Payload
- func (self *Xgress) GetStartCircuit() *Payload
- func (self *Xgress) GetTimeOfLastRxFromLink() int64
- func (self *Xgress) HandleControlReceive(controlType ControlType, headers channel2.Headers)
- func (self *Xgress) IsCircuitStarted() bool
- func (self *Xgress) IsEndOfCircuitReceived() bool
- func (self *Xgress) IsEndOfCircuitSent() bool
- func (self *Xgress) IsTerminator() bool
- func (self *Xgress) Label() string
- func (self *Xgress) Originator() Originator
- func (self *Xgress) PayloadReceived(payload *Payload)
- func (self *Xgress) SendAcknowledgement(acknowledgement *Acknowledgement) error
- func (self *Xgress) SendControl(control *Control) error
- func (self *Xgress) SendEmptyAck()
- func (self *Xgress) SendPayload(payload *Payload) error
- func (self *Xgress) SetReceiveHandler(receiveHandler ReceiveHandler)
- func (self *Xgress) Start()
- func (self *Xgress) Unrouted()
Constants ¶
View Source
const ( MinHeaderKey = 2000 MaxHeaderKey = MinHeaderKey + int32(math.MaxUint8) HeaderKeyCircuitId = 2256 HeaderKeySequence = 2257 HeaderKeyFlags = 2258 HeaderKeyRecvBufferSize = 2259 HeaderKeyRTT = 2260 ContentTypePayloadType = 1100 ContentTypeAcknowledgementType = 1101 ContentTypeControlType = 1102 )
View Source
const ( ControlHopCount = 1 ControlHopType = 2 ControlHopId = 3 ControlTimestamp = 4 ControlCustom1 = 5 ControlCustom2 = 6 )
View Source
const DECODER = "data"
View Source
const (
HeaderKeyUUID = 0
)
Variables ¶
View Source
var ContentTypeValue = map[string]int32{ "PayloadType": ContentTypePayloadType, "AcknowledgementType": ContentTypeAcknowledgementType, "ControlType": ContentTypeControlType, }
Functions ¶
func DecodePayload ¶
func GlobalRegistry ¶
func GlobalRegistry() *registry
func InitAcker ¶ added in v0.15.0
func InitAcker(forwarder PayloadBufferForwarder, metrics metrics.Registry, closeNotify <-chan struct{})
func InitMetrics ¶ added in v0.15.0
func InitMetrics(registry metrics.UsageRegistry)
func InitPayloadIngester ¶ added in v0.15.0
func InitPayloadIngester(closeNotify <-chan struct{})
func InitRetransmitter ¶ added in v0.15.0
func InitRetransmitter(forwarder PayloadBufferForwarder, faultReporter RetransmitterFaultReporter, metrics metrics.Registry, closeNotify <-chan struct{})
func NewRegistry ¶
func NewRegistry() *registry
func ReadUntilNewline ¶
func ReadUntilNewline(peer transport.Connection) ([]byte, error)
func RemoveTerminator ¶
func RemoveTerminator(ctrl CtrlChannel, terminatorId string) error
func RespondToTraceRequest ¶ added in v0.16.114
func RespondToTraceRequest(headers channel2.Headers, hopType, hopId string, response ControlReceiver)
func SetOriginatorFlag ¶
func SetOriginatorFlag(flags uint32, originator Originator) uint32
Types ¶
type Acknowledgement ¶
func NewAcknowledgement ¶
func NewAcknowledgement(circuitId string, originator Originator) *Acknowledgement
func UnmarshallAcknowledgement ¶
func UnmarshallAcknowledgement(msg *channel.Message) (*Acknowledgement, error)
func UnmarshallChannel2Acknowledgement ¶ added in v0.17.18
func UnmarshallChannel2Acknowledgement(msg *channel2.Message) (*Acknowledgement, error)
func (*Acknowledgement) GetLoggerFields ¶ added in v0.15.0
func (ack *Acknowledgement) GetLoggerFields() logrus.Fields
func (*Acknowledgement) GetSequence ¶
func (ack *Acknowledgement) GetSequence() []int32
func (*Acknowledgement) Marshall ¶
func (ack *Acknowledgement) Marshall() *channel2.Message
type BindHandler ¶
type BindHandler interface {
HandleXgressBind(x *Xgress)
}
The BindHandlers are invoked to install the appropriate handlers.
type Channel2Decoder ¶ added in v0.17.18
type Channel2Decoder struct{}
type CircuitInfo ¶ added in v0.16.92
type CircuitInfo struct { CircuitId *identity.TokenId Address Address ResponseMsg *channel2.Message // contains filtered or unexported fields }
func GetCircuit ¶ added in v0.16.92
func GetCircuit(ctrl CtrlChannel, ingressId string, serviceId string, timeout time.Duration, peerData map[uint32][]byte) (*CircuitInfo, error)
type CloseHandler ¶
type CloseHandler interface { // HandleXgressClose is invoked when the connected peer terminates the communication. // HandleXgressClose(x *Xgress) }
CloseHandler is invoked by an xgress when the connected peer terminates the communication.
type CloseHandlerF ¶ added in v0.16.30
type CloseHandlerF func(x *Xgress)
CloseHandlerF is the function version of CloseHandler
func (CloseHandlerF) HandleXgressClose ¶ added in v0.16.30
func (self CloseHandlerF) HandleXgressClose(x *Xgress)
type CloseHelper ¶
type CloseHelper struct {
// contains filtered or unexported fields
}
func (*CloseHelper) Close ¶
func (self *CloseHelper) Close() error
func (*CloseHelper) Init ¶
func (self *CloseHelper) Init(closer io.Closer)
type Connection ¶
type Control ¶ added in v0.16.114
type Control struct { Type ControlType CircuitId string Headers channel2.Headers }
func UnmarshallControl ¶ added in v0.16.114
func (*Control) CreateTraceResponse ¶ added in v0.16.114
func (*Control) DecrementAndGetHop ¶ added in v0.16.114
func (*Control) GetLoggerFields ¶ added in v0.16.114
func (*Control) IsTypeTraceRoute ¶ added in v0.16.114
func (*Control) IsTypeTraceRouteResponse ¶ added in v0.16.114
type ControlReceiver ¶ added in v0.16.114
type ControlReceiver interface {
HandleControlReceive(controlType ControlType, headers channel2.Headers)
}
type ControlType ¶ added in v0.16.114
type ControlType byte
const ( ControlTypeTraceRoute ControlType = 1 ControlTypeTraceRouteResponse = 2 )
type CtrlChannel ¶
type Factory ¶
type Factory interface { CreateListener(optionsData OptionsData) (Listener, error) CreateDialer(optionsData OptionsData) (Dialer, error) }
type Header ¶
func (*Header) GetCircuitId ¶ added in v0.16.92
func (*Header) GetOriginator ¶
func (header *Header) GetOriginator() Originator
type LinkReceiveBuffer ¶ added in v0.15.0
type LinkReceiveBuffer struct {
// contains filtered or unexported fields
}
func NewLinkReceiveBuffer ¶ added in v0.15.0
func NewLinkReceiveBuffer() *LinkReceiveBuffer
func (*LinkReceiveBuffer) PeekHead ¶ added in v0.15.0
func (buffer *LinkReceiveBuffer) PeekHead() *Payload
func (*LinkReceiveBuffer) ReceiveUnordered ¶ added in v0.15.0
func (buffer *LinkReceiveBuffer) ReceiveUnordered(payload *Payload, maxSize uint32) bool
func (*LinkReceiveBuffer) Remove ¶ added in v0.15.0
func (buffer *LinkReceiveBuffer) Remove(payload *Payload)
func (*LinkReceiveBuffer) Size ¶ added in v0.15.0
func (buffer *LinkReceiveBuffer) Size() uint32
type LinkSendBuffer ¶ added in v0.15.0
type LinkSendBuffer struct {
// contains filtered or unexported fields
}
func NewLinkSendBuffer ¶ added in v0.15.0
func NewLinkSendBuffer(x *Xgress) *LinkSendBuffer
func (*LinkSendBuffer) BufferPayload ¶ added in v0.15.0
func (buffer *LinkSendBuffer) BufferPayload(payload *Payload) (func(), error)
func (*LinkSendBuffer) Close ¶ added in v0.15.0
func (buffer *LinkSendBuffer) Close()
func (*LinkSendBuffer) CloseWhenEmpty ¶ added in v0.15.2
func (buffer *LinkSendBuffer) CloseWhenEmpty() bool
func (*LinkSendBuffer) ReceiveAcknowledgement ¶ added in v0.15.0
func (buffer *LinkSendBuffer) ReceiveAcknowledgement(ack *Acknowledgement)
type Listener ¶
type Listener interface { Listen(address string, bindHandler BindHandler) error Close() error }
type Options ¶
type Options struct { Mtu int32 RandomDrops bool Drop1InN int32 TxQueueSize int32 TxPortalStartSize uint32 TxPortalMaxSize uint32 TxPortalMinSize uint32 TxPortalIncreaseThresh uint32 TxPortalIncreaseScale float64 TxPortalRetxThresh uint32 TxPortalRetxScale float64 TxPortalDupAckThresh uint32 TxPortalDupAckScale float64 RxBufferSize uint32 RetxStartMs uint32 RetxScale float64 RetxAddMs uint32 MaxCloseWait time.Duration GetCircuitTimeout time.Duration CircuitStartTimeout time.Duration ConnectTimeout time.Duration }
Options contains common Xgress configuration options
func DefaultOptions ¶
func DefaultOptions() *Options
func LoadOptions ¶
func LoadOptions(data OptionsData) (*Options, error)
type OptionsData ¶
type OptionsData map[interface{}]interface{}
type Originator ¶
type Originator int32
const ( Initiator Originator = 0 Terminator Originator = 1 )
func (Originator) String ¶
func (o Originator) String() string
type Payload ¶
func UnmarshallChannel2Payload ¶ added in v0.17.18
func (*Payload) GetLoggerFields ¶
func (*Payload) GetSequence ¶
func (*Payload) IsCircuitEndFlagSet ¶ added in v0.16.92
func (*Payload) IsCircuitStartFlagSet ¶ added in v0.16.92
type PayloadBufferForwarder ¶
type PayloadFlag ¶
type PayloadFlag uint32
const ( PayloadFlagCircuitEnd PayloadFlag = 1 PayloadFlagEgress PayloadFlag = 2 PayloadFlagCircuitStart PayloadFlag = 4 )
type PayloadIngester ¶ added in v0.15.0
type PayloadIngester struct {
// contains filtered or unexported fields
}
func NewPayloadIngester ¶ added in v0.15.0
func NewPayloadIngester(closeNotify <-chan struct{}) *PayloadIngester
type PeekHandler ¶
type PeekHandler interface { Rx(x *Xgress, payload *Payload) Tx(x *Xgress, payload *Payload) Close(x *Xgress) }
PeekHandler allows registering watcher to react to data flowing an xgress instance
type ReceiveHandler ¶
type ReceiveHandler interface { // HandleXgressReceive is invoked when data is received from the connected xgress peer. // HandleXgressReceive(payload *Payload, x *Xgress) HandleControlReceive(control *Control, x *Xgress) }
ReceiveHandler is invoked by an xgress whenever data is received from the connected peer. Generally a ReceiveHandler is implemented to connect the xgress to a data plane data transmission system.
type Request ¶
func ReceiveRequest ¶
func ReceiveRequest(peer transport.Connection) (*Request, error)
func RequestFromJSON ¶
type Response ¶
type Response struct { Success bool `json:"scc"` Message string `json:"msg"` CircuitId string `json:"circuitId"` }
func CreateCircuit ¶ added in v0.16.92
func CreateCircuit(ctrl CtrlChannel, peer Connection, request *Request, bindHandler BindHandler, options *Options) *Response
func ReceiveResponse ¶
func ReceiveResponse(peer transport.Connection) (*Response, error)
func ResponseFromJSON ¶
type Retransmitter ¶ added in v0.15.0
type Retransmitter struct {
// contains filtered or unexported fields
}
func NewRetransmitter ¶ added in v0.15.0
func NewRetransmitter(forwarder PayloadBufferForwarder, faultReporter RetransmitterFaultReporter, metrics metrics.Registry, closeNotify <-chan struct{}) *Retransmitter
type RetransmitterFaultReporter ¶ added in v0.15.24
type RetransmitterFaultReporter interface {
ReportForwardingFault(circuitId string)
}
type Xgress ¶
type Xgress struct { Options *Options // contains filtered or unexported fields }
func NewXgress ¶
func NewXgress(circuitId *identity.TokenId, address Address, peer Connection, originator Originator, options *Options) *Xgress
func (*Xgress) AddCloseHandler ¶ added in v0.16.30
func (self *Xgress) AddCloseHandler(closeHandler CloseHandler)
func (*Xgress) AddPeekHandler ¶
func (self *Xgress) AddPeekHandler(peekHandler PeekHandler)
func (*Xgress) Close ¶
func (self *Xgress) Close()
Things which can trigger close
1. Read fails 2. Write fails 3. End of Circuit received 4. Unroute received
func (*Xgress) CloseTimeout ¶
func (*Xgress) ForwardEndOfCircuit ¶ added in v0.16.92
func (*Xgress) GetEndCircuit ¶ added in v0.16.92
func (*Xgress) GetStartCircuit ¶ added in v0.16.92
func (*Xgress) GetTimeOfLastRxFromLink ¶ added in v0.15.17
func (*Xgress) HandleControlReceive ¶ added in v0.16.114
func (self *Xgress) HandleControlReceive(controlType ControlType, headers channel2.Headers)
func (*Xgress) IsCircuitStarted ¶ added in v0.16.92
func (*Xgress) IsEndOfCircuitReceived ¶ added in v0.16.92
func (*Xgress) IsEndOfCircuitSent ¶ added in v0.16.92
func (*Xgress) IsTerminator ¶
func (*Xgress) Originator ¶
func (self *Xgress) Originator() Originator
func (*Xgress) PayloadReceived ¶ added in v0.15.0
func (*Xgress) SendAcknowledgement ¶
func (self *Xgress) SendAcknowledgement(acknowledgement *Acknowledgement) error
func (*Xgress) SendControl ¶ added in v0.16.114
func (*Xgress) SendEmptyAck ¶ added in v0.15.0
func (self *Xgress) SendEmptyAck()
func (*Xgress) SendPayload ¶
func (*Xgress) SetReceiveHandler ¶
func (self *Xgress) SetReceiveHandler(receiveHandler ReceiveHandler)
Click to show internal directories.
Click to hide internal directories.