conn

package
v0.0.0-...-1cf758b Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StateNew is the initial state of a client connection; before a welcome
	// message is sent.
	StateNew connState = iota

	// StateNotAuthenticated is when a welcome message has been sent but hasn't
	// yet authenticated.
	StateNotAuthenticated

	// StateAuthenticated is when a client has successfully authenticated but
	// not yet selected a mailbox.
	StateAuthenticated

	// StateSelected is when a client has successfully selected a mailbox.
	StateSelected

	// StateLoggedOut is when a client has disconnected from the server.
	StateLoggedOut
)

Variables

View Source
var ErrUnrecognisedParameter = errors.New("Unrecognised Parameter")

ErrUnrecognisedParameter indicates that the parameter requested in a FETCH command is unrecognised or not implemented in this IMAP server

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Rwc             io.ReadWriteCloser
	RwcScanner      *bufio.Scanner // Provides an interface for scanning lines from the connection
	Transcript      io.Writer
	Mailstore       mailstore.Mailstore // Pointer to the IMAP server's mailstore to which this connection belongs
	User            mailstore.User
	SelectedMailbox mailstore.Mailbox
	// contains filtered or unexported fields
}

Conn represents a client connection to the IMAP server

func NewConn

func NewConn(mailstore mailstore.Mailstore, netConn io.ReadWriteCloser, transcript io.Writer) (c *Conn)

NewConn creates a new client connection. It's intended to be directly used with a network connection. The transcript logs all client/server interactions and is very useful while debugging.

func (*Conn) Close

func (c *Conn) Close() error

Close forces the server to close the client's connection.

func (*Conn) ReadFixedLength

func (c *Conn) ReadFixedLength(length int) (data []byte, err error)

ReadFixedLength reads data from the connection up to the specified length.

func (*Conn) ReadLine

func (c *Conn) ReadLine() (text string, ok bool)

ReadLine awaits a single line from the client.

func (*Conn) SetReadOnly

func (c *Conn) SetReadOnly()

SetReadOnly sets the client connection as read-only. It forbids any operations that may modify data.

func (*Conn) SetReadWrite

func (c *Conn) SetReadWrite()

SetReadWrite sets the connection as read-write.

func (*Conn) SetState

func (c *Conn) SetState(state connState)

SetState sets the state that an IMAP client is in. It also resets any mailbox write access.

func (*Conn) Start

func (c *Conn) Start() error

Start tells the server to start communicating with the client (after the connection has been opened).

func (*Conn) Write

func (c *Conn) Write(p []byte) (n int, err error)

Write a response to the client. Implements io.Writer.

Jump to

Keyboard shortcuts

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