package textproto

Import Path
	net/textproto (on golang.org and go.dev)

Dependency Relation
	imports 9 packages, and imported by 9 packages

Involved Source Files
	    header.go
	    pipeline.go
	    reader.go
	d-> textproto.go
	    writer.go

Exported Type Names

type Conn (struct) A Conn represents a textual network protocol connection. It consists of a Reader and Writer to manage I/O and a Pipeline to sequence concurrent requests on the connection. These embedded types carry methods with them; see the documentation of those types for details. Pipeline Pipeline Reader Reader Reader.R *bufio.Reader Writer Writer Writer.W *bufio.Writer (*T) Close() error (*T) Cmd(format string, args ...interface{}) (id uint, err error) (*T) DotReader() io.Reader (*T) DotWriter() io.WriteCloser (*T) EndRequest(id uint) (*T) EndResponse(id uint) (*T) Next() uint (*T) PrintfLine(format string, args ...interface{}) error (*T) ReadCodeLine(expectCode int) (code int, message string, err error) (*T) ReadContinuedLine() (string, error) (*T) ReadContinuedLineBytes() ([]byte, error) (*T) ReadDotBytes() ([]byte, error) (*T) ReadDotLines() ([]string, error) (*T) ReadLine() (string, error) (*T) ReadLineBytes() ([]byte, error) (*T) ReadMIMEHeader() (MIMEHeader, error) (*T) ReadResponse(expectCode int) (code int, message string, err error) (*T) StartRequest(id uint) (*T) StartResponse(id uint) *T : io.Closer func Dial(network, addr string) (*Conn, error) func NewConn(conn io.ReadWriteCloser) *Conn
type Error (struct) An Error represents a numeric error response from a server. Code int Msg string (*T) Error() string *T : error
type MIMEHeader (map) A MIMEHeader represents a MIME-style header mapping keys to sets of values. (T) Add(key, value string) (T) Del(key string) (T) Get(key string) string (T) Set(key, value string) (T) Values(key string) []string func (*Reader).ReadMIMEHeader() (MIMEHeader, error) func mime/multipart.(*Writer).CreatePart(header MIMEHeader) (io.Writer, error)
type Pipeline (struct) A Pipeline manages a pipelined in-order request/response sequence. To use a Pipeline p to manage multiple clients on a connection, each client should run: id := p.Next() // take a number p.StartRequest(id) // wait for turn to send request «send request» p.EndRequest(id) // notify Pipeline that request is sent p.StartResponse(id) // wait for turn to read response «read response» p.EndResponse(id) // notify Pipeline that response is read A pipelined server can use the same calls to ensure that responses computed in parallel are written in the correct order. (*T) EndRequest(id uint) (*T) EndResponse(id uint) (*T) Next() uint (*T) StartRequest(id uint) (*T) StartResponse(id uint)
type ProtocolError string A ProtocolError describes a protocol violation such as an invalid response or a hung-up connection. (T) Error() string T : error
type Reader (struct) A Reader implements convenience methods for reading requests or responses from a text protocol network connection. R *bufio.Reader (*T) DotReader() io.Reader (*T) ReadCodeLine(expectCode int) (code int, message string, err error) (*T) ReadContinuedLine() (string, error) (*T) ReadContinuedLineBytes() ([]byte, error) (*T) ReadDotBytes() ([]byte, error) (*T) ReadDotLines() ([]string, error) (*T) ReadLine() (string, error) (*T) ReadLineBytes() ([]byte, error) (*T) ReadMIMEHeader() (MIMEHeader, error) (*T) ReadResponse(expectCode int) (code int, message string, err error) func NewReader(r *bufio.Reader) *Reader
type Writer (struct) A Writer implements convenience methods for writing requests or responses to a text protocol network connection. W *bufio.Writer (*T) DotWriter() io.WriteCloser (*T) PrintfLine(format string, args ...interface{}) error func NewWriter(w *bufio.Writer) *Writer
Exported Values
func CanonicalMIMEHeaderKey(s string) string CanonicalMIMEHeaderKey returns the canonical format of the MIME header key s. The canonicalization converts the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for "accept-encoding" is "Accept-Encoding". MIME header keys are assumed to be ASCII only. If s contains a space or invalid header field bytes, it is returned without modifications.
func Dial(network, addr string) (*Conn, error) Dial connects to the given address on the given network using net.Dial and then returns a new Conn for the connection.
func NewConn(conn io.ReadWriteCloser) *Conn NewConn returns a new Conn using conn for I/O.
func NewReader(r *bufio.Reader) *Reader NewReader returns a new Reader reading from r. To avoid denial of service attacks, the provided bufio.Reader should be reading from an io.LimitReader or similar Reader to bound the size of responses.
func NewWriter(w *bufio.Writer) *Writer NewWriter returns a new Writer writing to w.
func TrimBytes(b []byte) []byte TrimBytes returns b without leading and trailing ASCII space.
func TrimString(s string) string TrimString returns s without leading and trailing ASCII space.