message

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

package for parsing, packing, signing, verifying nntp articles

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {

	// the article's mime header
	Header Header
}

an nntp article

type Attachment

type Attachment struct {
	// mimetype
	Mime string
	// the filename
	FileName string
	// the fully decoded attachment body
	// must close when done
	Body io.ReadCloser
}

attachment in an nntp article

type Header map[string][]string

an nntp message header

func (Header) Add

func (self Header) Add(key, val string)

append value to key

func (Header) AppendPath

func (self Header) AppendPath(name string)

func (Header) Get

func (self Header) Get(key, fallback string) string

get via key or return fallback value

func (Header) GetMediaType

func (self Header) GetMediaType() (mediatype string, params map[string]string, err error)

extract media type from content-type header

func (Header) Has

func (self Header) Has(key string) bool

do we have a key in this header?

func (Header) IsMultipart

func (self Header) IsMultipart() bool

is this header for a multipart message?

func (Header) IsSigned

func (self Header) IsSigned() bool

func (Header) MessageID

func (self Header) MessageID() (v string)

get message-id header

func (Header) Newsgroup

func (self Header) Newsgroup() string

func (Header) Reference

func (self Header) Reference() (ref string)

func (Header) Set

func (self Header) Set(key, val string)

set key value

type HeaderIO

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

implements HeaderReader and HeaderWriter

func NewHeaderIO

func NewHeaderIO() *HeaderIO

func (*HeaderIO) ReadHeader

func (s *HeaderIO) ReadHeader(r io.Reader) (hdr Header, err error)

read header

func (*HeaderIO) WriteHeader

func (s *HeaderIO) WriteHeader(hdr Header, wr io.Writer) (err error)

write header

type HeaderReader

type HeaderReader interface {
	// blocking read an nntp header from an io.Reader
	// return the read header and nil on success
	// return nil and an error if an error occurred while reading
	ReadHeader(r io.Reader) (Header, error)
}

interface for types that can read an nntp header

type HeaderWriter

type HeaderWriter interface {
	// blocking write an nntp header to an io.Writer
	// returns an error if one occurs otherwise nil
	WriteHeader(hdr Header, w io.Writer) error
}

interface for types that can write an nntp header

Jump to

Keyboard shortcuts

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