v.io: v.io/x/ref/runtime/internal/flow/conn Index | Files

package conn

import "v.io/x/ref/runtime/internal/flow/conn"

nolint:golint

Index

Package Files

auth.go bufferingflow.go conn.go conn.vdl.go errors.go flow.go ibe.go message.go readq.go

Constants

const (
    DefaultBytesBufferedPerFlow = 1 << 20
)

Variables

var (
    ErrMissingSetupOption       = verror.NewID("MissingSetupOption")
    ErrUnexpectedMsg            = verror.NewID("UnexpectedMsg")
    ErrConnectionClosed         = verror.NewID("ConnectionClosed")
    ErrRemoteError              = verror.NewID("RemoteError")
    ErrSend                     = verror.NewID("Send")
    ErrRecv                     = verror.NewID("Recv")
    ErrCounterOverflow          = verror.NewID("CounterOverflow")
    ErrBlessingsFlowClosed      = verror.NewID("BlessingsFlowClosed")
    ErrInvalidChannelBinding    = verror.NewID("InvalidChannelBinding")
    ErrNoPublicKey              = verror.NewID("NoPublicKey")
    ErrDialingNonServer         = verror.NewID("DialingNonServer")
    ErrAcceptorBlessingsMissing = verror.NewID("AcceptorBlessingsMissing")
    ErrDialerBlessingsMissing   = verror.NewID("DialerBlessingsMissing")
    ErrBlessingsNotBound        = verror.NewID("BlessingsNotBound")
    ErrInvalidPeerFlow          = verror.NewID("InvalidPeerFlow")
    ErrChannelTimeout           = verror.NewID("ChannelTimeout")
    ErrCannotDecryptBlessings   = verror.NewID("CannotDecryptBlessings")
    ErrCannotDecryptDischarges  = verror.NewID("CannotDecryptDischarges")
    ErrCannotEncryptBlessings   = verror.NewID("CannotEncryptBlessings")
    ErrCannotEncryptDischarges  = verror.NewID("CannotEncryptDischarges")
    ErrNoCrypter                = verror.NewID("NoCrypter")
    ErrNoPrivateKey             = verror.NewID("NoPrivateKey")
    ErrIdleConnKilled           = verror.NewID("IdleConnKilled")
)

These were previously defined in errors.vdl using the ID values below rather than the more conventional Err<Name>.

func VDLReadBlessingsFlowMessage Uses

func VDLReadBlessingsFlowMessage(dec vdl.Decoder, x *BlessingsFlowMessage) error

type Blessings Uses

type Blessings struct {
    Blessings security.Blessings
    BKey      uint64
}

Blessings is used to transport blessings between the two ends of a Conn. Since blessings can be large, we try not to send them more than once by associating them with an integer key (BKey). Thereafter we refer to them by their key.

func (Blessings) VDLIsZero Uses

func (x Blessings) VDLIsZero() bool

func (*Blessings) VDLRead Uses

func (x *Blessings) VDLRead(dec vdl.Decoder) error

func (Blessings) VDLReflect Uses

func (Blessings) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/runtime/internal/flow/conn.Blessings"`
})

func (Blessings) VDLWrite Uses

func (x Blessings) VDLWrite(enc vdl.Encoder) error

type BlessingsFlowMessage Uses

type BlessingsFlowMessage interface {
    // Index returns the field index.
    Index() int
    // Interface returns the field value as an interface.
    Interface() interface{}
    // Name returns the field name.
    Name() string
    // VDLReflect describes the BlessingsFlowMessage union type.
    VDLReflect(vdlBlessingsFlowMessageReflect)
    VDLIsZero() bool
    VDLWrite(vdl.Encoder) error
}

BlessingsFlowMessage represents any single field of the BlessingsFlowMessage union type.

BlessingsFlowMessage is used to send either a Blessings, Discharges, EncryptedBlessings or EncryptedDischarges object over the wire.

type BlessingsFlowMessageBlessings Uses

type BlessingsFlowMessageBlessings struct{ Value Blessings }

BlessingsFlowMessageBlessings represents field Blessings of the BlessingsFlowMessage union type.

func (BlessingsFlowMessageBlessings) Index Uses

func (x BlessingsFlowMessageBlessings) Index() int

func (BlessingsFlowMessageBlessings) Interface Uses

func (x BlessingsFlowMessageBlessings) Interface() interface{}

func (BlessingsFlowMessageBlessings) Name Uses

func (x BlessingsFlowMessageBlessings) Name() string

func (BlessingsFlowMessageBlessings) VDLIsZero Uses

func (x BlessingsFlowMessageBlessings) VDLIsZero() bool

func (BlessingsFlowMessageBlessings) VDLReflect Uses

func (x BlessingsFlowMessageBlessings) VDLReflect(vdlBlessingsFlowMessageReflect)

func (BlessingsFlowMessageBlessings) VDLWrite Uses

func (x BlessingsFlowMessageBlessings) VDLWrite(enc vdl.Encoder) error

type BlessingsFlowMessageDischarges Uses

type BlessingsFlowMessageDischarges struct{ Value Discharges }

BlessingsFlowMessageDischarges represents field Discharges of the BlessingsFlowMessage union type.

func (BlessingsFlowMessageDischarges) Index Uses

func (x BlessingsFlowMessageDischarges) Index() int

func (BlessingsFlowMessageDischarges) Interface Uses

func (x BlessingsFlowMessageDischarges) Interface() interface{}

func (BlessingsFlowMessageDischarges) Name Uses

func (x BlessingsFlowMessageDischarges) Name() string

func (BlessingsFlowMessageDischarges) VDLIsZero Uses

func (x BlessingsFlowMessageDischarges) VDLIsZero() bool

func (BlessingsFlowMessageDischarges) VDLReflect Uses

func (x BlessingsFlowMessageDischarges) VDLReflect(vdlBlessingsFlowMessageReflect)

func (BlessingsFlowMessageDischarges) VDLWrite Uses

func (x BlessingsFlowMessageDischarges) VDLWrite(enc vdl.Encoder) error

type BlessingsFlowMessageEncryptedBlessings Uses

type BlessingsFlowMessageEncryptedBlessings struct{ Value EncryptedBlessings }

BlessingsFlowMessageEncryptedBlessings represents field EncryptedBlessings of the BlessingsFlowMessage union type.

func (BlessingsFlowMessageEncryptedBlessings) Index Uses

func (x BlessingsFlowMessageEncryptedBlessings) Index() int

func (BlessingsFlowMessageEncryptedBlessings) Interface Uses

func (x BlessingsFlowMessageEncryptedBlessings) Interface() interface{}

func (BlessingsFlowMessageEncryptedBlessings) Name Uses

func (x BlessingsFlowMessageEncryptedBlessings) Name() string

func (BlessingsFlowMessageEncryptedBlessings) VDLIsZero Uses

func (x BlessingsFlowMessageEncryptedBlessings) VDLIsZero() bool

func (BlessingsFlowMessageEncryptedBlessings) VDLReflect Uses

func (x BlessingsFlowMessageEncryptedBlessings) VDLReflect(vdlBlessingsFlowMessageReflect)

func (BlessingsFlowMessageEncryptedBlessings) VDLWrite Uses

func (x BlessingsFlowMessageEncryptedBlessings) VDLWrite(enc vdl.Encoder) error

type BlessingsFlowMessageEncryptedDischarges Uses

type BlessingsFlowMessageEncryptedDischarges struct{ Value EncryptedDischarges }

BlessingsFlowMessageEncryptedDischarges represents field EncryptedDischarges of the BlessingsFlowMessage union type.

func (BlessingsFlowMessageEncryptedDischarges) Index Uses

func (x BlessingsFlowMessageEncryptedDischarges) Index() int

func (BlessingsFlowMessageEncryptedDischarges) Interface Uses

func (x BlessingsFlowMessageEncryptedDischarges) Interface() interface{}

func (BlessingsFlowMessageEncryptedDischarges) Name Uses

func (x BlessingsFlowMessageEncryptedDischarges) Name() string

func (BlessingsFlowMessageEncryptedDischarges) VDLIsZero Uses

func (x BlessingsFlowMessageEncryptedDischarges) VDLIsZero() bool

func (BlessingsFlowMessageEncryptedDischarges) VDLReflect Uses

func (x BlessingsFlowMessageEncryptedDischarges) VDLReflect(vdlBlessingsFlowMessageReflect)

func (BlessingsFlowMessageEncryptedDischarges) VDLWrite Uses

func (x BlessingsFlowMessageEncryptedDischarges) VDLWrite(enc vdl.Encoder) error

type BufferingFlow Uses

type BufferingFlow struct {
    flow.Flow
    // contains filtered or unexported fields
}

BufferingFlow wraps a Flow and buffers all its writes. It only truly writes to the underlying flow when the buffered data exceeds the MTU of the underlying channel, or Flush, Close, or WriteMsgAndClose is called.

func NewBufferingFlow Uses

func NewBufferingFlow(ctx *context.T, flw flow.Flow) *BufferingFlow

func (*BufferingFlow) Close Uses

func (b *BufferingFlow) Close() error

Close flushes the already written data and then closes the underlying Flow.

func (*BufferingFlow) Flush Uses

func (b *BufferingFlow) Flush() (err error)

Flush writes all buffered data to the underlying Flow.

func (*BufferingFlow) Write Uses

func (b *BufferingFlow) Write(data []byte) (int, error)

Write buffers data until the underlying channels MTU is reached at which point it calls Write on the wrapped Flow.

func (*BufferingFlow) WriteMsg Uses

func (b *BufferingFlow) WriteMsg(data ...[]byte) (int, error)

WriteMsg buffers data until the underlying channels MTU is reached at which point it calls WriteMsg on the wrapped Flow.

func (*BufferingFlow) WriteMsgAndClose Uses

func (b *BufferingFlow) WriteMsgAndClose(data ...[]byte) (int, error)

WriteMsgAndClose writes all buffered data and closes the underlying Flow.

type Conn Uses

type Conn struct {
    // contains filtered or unexported fields
}

A Conn acts as a multiplexing encrypted channel that can host Flows.

func NewAccepted Uses

func NewAccepted(
    ctx *context.T,
    lAuthorizedPeers []security.BlessingPattern,
    conn flow.MsgReadWriteCloser,
    local naming.Endpoint,
    versions version.RPCVersionRange,
    handshakeTimeout time.Duration,
    channelTimeout time.Duration,
    handler FlowHandler) (*Conn, error)

NewAccepted accepts a new Conn on the given conn.

NOTE: that the FlowHandler must be called asynchronously since it may

block until this function returns.

func NewDialed Uses

func NewDialed(
    ctx *context.T,
    conn flow.MsgReadWriteCloser,
    local, remote naming.Endpoint,
    versions version.RPCVersionRange,
    auth flow.PeerAuthorizer,
    proxy bool,
    handshakeTimeout time.Duration,
    channelTimeout time.Duration,
    handler FlowHandler) (c *Conn, names []string, rejected []security.RejectedBlessing, err error)

NewDialed dials a new Conn on the given conn. In the case when it is not dialing a proxy, it can return an error indicating that the context was canceled (verror.ErrCanceled) along with a handshake completes within the specified handshakeTimeout duration. Or put another way, NewDialed will always waut for at most handshakeTimeout duration to complete the handshake even if the context is canceled. The behaviour is different for a proxy connection, in which case a cancelation is immediate and no attempt is made to establish the connection.

func (*Conn) Close Uses

func (c *Conn) Close(ctx *context.T, err error)

Close shuts down a conn.

func (*Conn) CloseIfIdle Uses

func (c *Conn) CloseIfIdle(ctx *context.T, idleExpiry time.Duration) bool

CloseIfIdle closes the connection if the conn has been idle for idleExpiry, returning true if it closed it.

func (*Conn) Closed Uses

func (c *Conn) Closed() <-chan struct{}

Closed returns a channel that will be closed after the Conn is shutdown. After this channel is closed it is guaranteed that all Dial calls will fail with an error and no more flows will be sent to the FlowHandler.

func (*Conn) CommonVersion Uses

func (c *Conn) CommonVersion() version.RPCVersion

CommonVersion returns the RPCVersion negotiated between the local and remote endpoints.

func (*Conn) DebugString Uses

func (c *Conn) DebugString() string

func (*Conn) Dial Uses

func (c *Conn) Dial(ctx *context.T, blessings security.Blessings, discharges map[string]security.Discharge,
    remote naming.Endpoint, channelTimeout time.Duration, sideChannel bool) (flow.Flow, error)

Dial dials a new flow on the Conn.

func (*Conn) EnterLameDuck Uses

func (c *Conn) EnterLameDuck(ctx *context.T) chan struct{}

EnterLameDuck enters lame duck mode, the returned channel will be closed when the remote end has ack'd or the Conn is closed.

func (*Conn) HasActiveFlows Uses

func (c *Conn) HasActiveFlows() bool

func (*Conn) IsEncapsulated Uses

func (c *Conn) IsEncapsulated() bool

func (*Conn) IsIdle Uses

func (c *Conn) IsIdle(ctx *context.T, idleExpiry time.Duration) bool

func (*Conn) LastUsed Uses

func (c *Conn) LastUsed() time.Time

LastUsed returns the time at which the Conn had bytes read or written on it.

func (*Conn) LocalBlessings Uses

func (c *Conn) LocalBlessings() security.Blessings

LocalBlessings returns the local blessings.

func (*Conn) LocalDischarges Uses

func (c *Conn) LocalDischarges() map[string]security.Discharge

LocalDischarges fetches the most recently sent discharges for the local ends blessings.

func (*Conn) LocalEndpoint Uses

func (c *Conn) LocalEndpoint() naming.Endpoint

LocalEndpoint returns the local vanadium Endpoint

func (*Conn) MTU Uses

func (c *Conn) MTU() uint64

MTU Returns the maximum transimission unit for the connection in bytes.

func (*Conn) MatchesRID Uses

func (c *Conn) MatchesRID(ep naming.Endpoint) bool

MatchesRID returns true if the given endpoint matches the routing ID of the remote server. Also returns true if the given ep has the null routing id (in which case it is assumed that any connected server must be the target since nothing has been specified).

func (*Conn) RTT Uses

func (c *Conn) RTT() time.Duration

RTT returns the round trip time of a message to the remote end. Note the initial estimate of the RTT from the accepted side of a connection my be long because we don't fully factor out certificate verification time. The RTT will be updated with the receipt of every healthCheckResponse, so this overestimate doesn't remain for long when the channel timeout is low.

func (*Conn) RemoteBlessings Uses

func (c *Conn) RemoteBlessings() security.Blessings

RemoteBlessings returns the remote blessings.

func (*Conn) RemoteDischarges Uses

func (c *Conn) RemoteDischarges() map[string]security.Discharge

RemoteDischarges fetches the most recently received discharges for the remote ends blessings.

func (*Conn) RemoteEndpoint Uses

func (c *Conn) RemoteEndpoint() naming.Endpoint

RemoteEndpoint returns the remote vanadium Endpoint

func (*Conn) RemoteLameDuck Uses

func (c *Conn) RemoteLameDuck() bool

RemoteLameDuck returns true if the other end of the connection has announced that it is in lame duck mode indicating that new flows should not be dialed on this conn.

func (*Conn) Status Uses

func (c *Conn) Status() Status

type Discharges Uses

type Discharges struct {
    Discharges []security.Discharge
    DKey       uint64
    BKey       uint64
}

Discharges is used to transport discharges between the two ends of a Conn. Since discharges can be large, we try not to send them more than once by associating them with an integer key (DKey). Thereafter we refer to them by their key. Discharges also contains the BKey of the blessings with which the discharges are associated with.

func (Discharges) VDLIsZero Uses

func (x Discharges) VDLIsZero() bool

func (*Discharges) VDLRead Uses

func (x *Discharges) VDLRead(dec vdl.Decoder) error

func (Discharges) VDLReflect Uses

func (Discharges) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/runtime/internal/flow/conn.Discharges"`
})

func (Discharges) VDLWrite Uses

func (x Discharges) VDLWrite(enc vdl.Encoder) error

type EncryptedBlessings Uses

type EncryptedBlessings struct {
    Ciphertexts []bcrypter.WireCiphertext
    BKey        uint64
}

EncryptedBlessings is used to transport encrypted blessings between the two ends of a Conn. The encryption is with respect to a set of blessing patterns that define the set of peers that are allowed to see the blessings. Since encrypted blessings can be large, we try not to send them more than once by associating them with an integer key (BKey). Thereafter we refer to them by their key.

func (EncryptedBlessings) VDLIsZero Uses

func (x EncryptedBlessings) VDLIsZero() bool

func (*EncryptedBlessings) VDLRead Uses

func (x *EncryptedBlessings) VDLRead(dec vdl.Decoder) error

func (EncryptedBlessings) VDLReflect Uses

func (EncryptedBlessings) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/runtime/internal/flow/conn.EncryptedBlessings"`
})

func (EncryptedBlessings) VDLWrite Uses

func (x EncryptedBlessings) VDLWrite(enc vdl.Encoder) error

type EncryptedDischarges Uses

type EncryptedDischarges struct {
    Ciphertexts []bcrypter.WireCiphertext
    DKey        uint64
    BKey        uint64
}

EncryptedDischarges is used to transport encrypted discharges between the two ends of a Conn. The encryption is with respect to a set of blessing patterns that define the set of peers that are allowed to see the discharges. Since discharges can be large, we try not to send them more than once by associating them with an integer key (DKey). Thereafter we refer to them by their key. EncryptedDischarges also contains the BKey of the blessings with which the plaintext discharges are associated with.

func (EncryptedDischarges) VDLIsZero Uses

func (x EncryptedDischarges) VDLIsZero() bool

func (*EncryptedDischarges) VDLRead Uses

func (x *EncryptedDischarges) VDLRead(dec vdl.Decoder) error

func (EncryptedDischarges) VDLReflect Uses

func (EncryptedDischarges) VDLReflect(struct {
    Name string `vdl:"v.io/x/ref/runtime/internal/flow/conn.EncryptedDischarges"`
})

func (EncryptedDischarges) VDLWrite Uses

func (x EncryptedDischarges) VDLWrite(enc vdl.Encoder) error

type FlowHandler Uses

type FlowHandler interface {
    // HandleFlow processes an accepted flow.
    HandleFlow(flow.Flow) error
}

A FlowHandler processes accepted flows.

type MTUer Uses

type MTUer interface {
    MTU() uint64
}

type Status Uses

type Status int
const (
    Active Status = iota
    EnteringLameDuck
    LameDuckAcknowledged
    Closing
    Closed
)

Note that this is a progression of states that can only go in one direction. We use inequality operators to see how far along in the progression we are, so the order of these is important.

Package conn imports 26 packages (graph) and is imported by 10 packages. Updated 2020-10-22. Refresh now. Tools for package owners.