Documentation ¶
Index ¶
- Constants
- Variables
- type ByteReader
- type Command
- type CommandOrMessage
- type Greeting
- func (g *Greeting) Mechanism() string
- func (g *Greeting) ReadFrom(r io.Reader) (int64, error)
- func (g *Greeting) Server() bool
- func (g *Greeting) SetMechanism(mech string)
- func (g *Greeting) SetServer(server bool)
- func (g *Greeting) SetVersionMajor(major uint8)
- func (g *Greeting) SetVersionMinor(minor uint8)
- func (g *Greeting) String() string
- func (g *Greeting) VersionMajor() uint8
- func (g *Greeting) VersionMinor() uint8
- func (g *Greeting) WriteTo(w io.Writer) (int64, error)
- type Mechanism
- type Message
- type Metadata
- type Socket
Constants ¶
const ( OptionServer = "server" OptionPubKey = "pubkey" OptionSecKey = "seckey" OptionSrvKey = "srvkey" )
Variables ¶
var ErrInvalidCommandSize invalidCommandSize
var ErrInvalidFrameHeader invalidFrameHeader
var ErrInvalidMetadata invalidMetadata
ErrInvalidMetadata is returned when the metadata cannot be parsed into its properties.
var ErrInvalidNameLength invalidNameLength
var ErrMechMismatch mechMismatch
var ErrNameTooLong nameTooLong
ErrNameTooLong is returns when the metadata contains a name specifier which is too long for the metadata length.
Functions ¶
This section is empty.
Types ¶
type ByteReader ¶
type ByteReader byte
type Command ¶
type CommandOrMessage ¶
type CommandOrMessage struct { // IsMessage is true iff this contains a message. IsMessage bool // Command is non nil iff message is nil. Command *Command // Message is non nil iff IsMessage is true. Message *Message }
CommandOrMessage may either contain a command or a message.
type Greeting ¶
type Greeting [64]byte
Greeting defines a zmtp greeting
func (*Greeting) SetMechanism ¶
SetMechanism sets the mechanism for this greeting.
func (*Greeting) SetVersionMajor ¶
SetVersionMajor sets the major version of this zmtp greeting.
func (*Greeting) SetVersionMinor ¶
SetVersionMinor sets the minor version of this zmtp greeting.
func (*Greeting) VersionMajor ¶
VersionMajor returns the major version of this zmtp greeting.
func (*Greeting) VersionMinor ¶
VersionMinor returns the minor version of this zmtp greeting.
type Mechanism ¶
type Mechanism interface { // Name of the mechanism. Name() string // ValidateGreeting returns an error if the greeting from another side is invalid for this mechanism. ValidateGreeting(*Greeting) (err error) // Handshake performs a handshake with the Connection. Handshake(net.Conn, Metadata) (s Socket, meta Metadata, err error) // Server field for the greeting for this handshake. Server() bool // SetOption sets an option in the mechanism. SetOption(option string, value any) error }
Mechanism implements the setup of new Connections.
type Message ¶
Message is a zmtp message.
type Socket ¶
type Socket interface { // Read the next part of traffic. Read() (CommandOrMessage, error) // Send a message on the socket. SendMessage(Message) error // SendCommand sends a command on the socket. SendCommand(Command) error // Access to the underlying conn. Net() net.Conn // Close the socket. Close() error }
Socket.