core: Index | Files | Directories

package wire

import ""

Package wire implements the Katzenpost wire protocol.


Package Files



const (
    // MaxAdditionalDataLength is the maximum length of the additional data
    // sent to the peer as part of the handshake authentication.
    MaxAdditionalDataLength = 255

type PeerAuthenticator Uses

type PeerAuthenticator interface {
    // IsPeerValid authenticates the remote peer's credentials, returning true
    // iff the peer is valid.
    IsPeerValid(*PeerCredentials) bool

PeerAuthenticator is the interface used to authenticate the remote peer, based on the authenticated key exchange.

type PeerCredentials Uses

type PeerCredentials struct {
    AdditionalData []byte
    PublicKey      *ecdh.PublicKey

PeerCredentials is the peer's credentials received during the authenticated key exchange. By virtue of the Noise Protocol's design, the AdditionalData is guaranteed to have been sent from a peer possessing the private component of PublicKey.

type Session Uses

type Session struct {
    // contains filtered or unexported fields

Session is a wire protocol session.

func NewSession Uses

func NewSession(cfg *SessionConfig, isInitiator bool) (*Session, error)

NewSession creates a new Session.

func (*Session) ClockSkew Uses

func (s *Session) ClockSkew() time.Duration

ClockSkew returns the approximate clock skew based on the responder's timestamp received as part of the handshake. This call MUST only be called from a session that has successfully completed Initialize(), and the peer is the responder.

func (*Session) Close Uses

func (s *Session) Close()

Close terminates a session.

func (*Session) Initialize Uses

func (s *Session) Initialize(conn net.Conn) error

Initialize takes an establised net.Conn, and binds it to a Session, and conducts the wire protocol handshake.

func (*Session) PeerCredentials Uses

func (s *Session) PeerCredentials() (*PeerCredentials, error)

PeerCredentials returns the peer's credentials. This call MUST only be called from a session that has successfully completed Initialize().

func (*Session) RecvCommand Uses

func (s *Session) RecvCommand() (commands.Command, error)

RecvCommand receives a wire protocol command off the network.

func (*Session) SendCommand Uses

func (s *Session) SendCommand(cmd commands.Command) error

SendCommand sends the wire protocol command cmd.

type SessionConfig Uses

type SessionConfig struct {
    // Authenticator is the PeerAuthenticator instance that will be used to
    // authenticate the remote peer for the newly created Session.
    Authenticator PeerAuthenticator

    // AdditionalData is the additional data that will be passed to the peer
    // as part of the wire protocol handshake, the length of which MUST be less
    // than or equal to MaxAdditionalDataLength.
    AdditionalData []byte

    // AuthenticationKey is the static long term authentication key used to
    // authenticate with the remote peer.
    AuthenticationKey *ecdh.PrivateKey

    // RandomReader is a cryptographic entropy source.
    RandomReader io.Reader

SessionConfig is the configuration used to create new Sessions.

type SessionInterface Uses

type SessionInterface interface {
    Initialize(conn net.Conn) error
    SendCommand(cmd commands.Command) error
    RecvCommand() (commands.Command, error)
    PeerCredentials() *PeerCredentials
    ClockSkew() time.Duration

SessionInterface is the interface used to initialize or teardown a Session and send and receive command.Commands.



Package wire imports 11 packages (graph) and is imported by 10 packages. Updated 2019-11-14. Refresh now. Tools for package owners.