nntp

package module
v0.0.0-...-0c4009c Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

nntp

Golang client for the NNTP protocol

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidNewsgroupOverviewLineReturned = errors.New("invalid news group overview line returned. Line must consist of 4 parts separated by space")

	ErrInvalidNewsGroupStatus = errors.New("invalid newsgroup status. Allowed: y,n,m")
)
View Source
var ErrInvalidDateFormat = errors.New("invalid date format")
View Source
var ErrInvalidGreetingResponse = errors.New("invalid greeting response returned from server")
View Source
var ErrInvalidHeaderCount = errors.New("invalid number of headers given")
View Source
var ErrInvalidNewsgroupLineReturned = errors.New("invalid news group line returned. Line must consist of 4 parts separated by space")

Functions

func ParseDate

func ParseDate(s string) (time.Time, error)

Types

type Client

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

func NewFromConn

func NewFromConn(conn io.ReadWriteCloser) (*Client, error)

func (*Client) Authenticate

func (c *Client) Authenticate(username, password string) error

func (*Client) Date

func (c *Client) Date() (time.Time, error)

func (*Client) Group

func (c *Client) Group(g string) (group NewsgroupDetail, err error)

func (*Client) Help

func (c *Client) Help() (string, error)

func (*Client) InitializeOverviewFormat

func (c *Client) InitializeOverviewFormat() error

func (*Client) Newsgroups

func (c *Client) Newsgroups(since time.Time) ([]NewsgroupOverview, error)

func (*Client) Quit

func (c *Client) Quit() error

func (*Client) SetOverviewFormat

func (c *Client) SetOverviewFormat(format *OverviewFormat)

func (*Client) Xover

func (c *Client) Xover(r string) ([]Header, error)

func (*Client) XoverChan

func (c *Client) XoverChan(r string) (chan Header, chan error, error)
type Header struct {
	MessageNumber uint64
	Subject       string
	Author        string
	Date          time.Time
	MessageID     string
	References    string
	Bytes         uint64
	Lines         uint64
	Additional    map[string]string
}

type NewsgroupDetail

type NewsgroupDetail struct {
	Name   string
	Low    uint64
	High   uint64
	Number uint64
}

type NewsgroupOverview

type NewsgroupOverview struct {
	Name   string
	Low    uint64
	High   uint64
	Status NewsgroupStatus
}

type NewsgroupStatus

type NewsgroupStatus string
const (
	// Posting is permitted
	NewsgroupStatusPostingPermitted NewsgroupStatus = "y"
	// Posting is not permitted
	NewsgroupStatusPostingProhibited NewsgroupStatus = "n"
	// Postings will be forwarded to the newsgroup moderator
	NewsgroupStatusPostingModerated NewsgroupStatus = "m"
)

type OverviewFormat

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

func DefaultOverviewFormat

func DefaultOverviewFormat() *OverviewFormat

func NewOverviewFormat

func NewOverviewFormat(fields []string) *OverviewFormat

func (*OverviewFormat) FieldToHeader

func (h *OverviewFormat) FieldToHeader(idx int, value string, header *Header) (err error)

func (*OverviewFormat) ParseXoverLine

func (h *OverviewFormat) ParseXoverLine(line string) (header Header, err error)

Jump to

Keyboard shortcuts

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