nntpclient

package
v0.0.0-...-7e6ab84 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Minimalistic Pipelined NNTP client.

Index

Constants

View Source
const (
	CheckOK          = 238 // Send article to be transferred
	CheckNotPossible = 431 // Transfer not possible; try again later
	CheckNotWanted   = 438 // Article not wanted
	TakethisOK       = 239
	TakethisRejected = 439
)

Variables

This section is empty.

Functions

func FinishDR

func FinishDR(dr *fastnntp.DotReader)

Types

type Connection

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

func NewConnection

func NewConnection(rwc io.ReadWriteCloser) (c *Connection, err error)

func (*Connection) Article

func (c *Connection) Article(args []byte, head, body bool, f func(dr *fastnntp.DotReader, msgid []byte)) (err error)

Submits one of the following commands: ARTICLE, HEAD, BODY or STAT.

func (*Connection) ArticleInto

func (c *Connection) ArticleInto(args []byte, head, body bool, t io.Writer) (msgid []byte, err error)

Submits one of the following commands: ARTICLE, HEAD, BODY or STAT.

func (*Connection) Check

func (c *Connection) Check(msgid []byte) (code int, err error)

Checks whether or not an article is wanted. Requires RFC-4644 (The STREAMING Extension)

func (*Connection) Close

func (c *Connection) Close() (err error)

Closes the connection. Handle with care: Any further attempt to perform a request panics after the connection is closed using Close().

func (*Connection) Group

func (c *Connection) Group(grp []byte) (num, low, high int64, err error)

Selects a newsgroup.

func (*Connection) ListActive

func (c *Connection) ListActive(f func(group []byte, high, low int64, status byte)) (err error)

List all newsgroups.

func (*Connection) ListNewsgroups

func (c *Connection) ListNewsgroups(f func(group []byte, descr []byte)) (err error)

List all newsgroups.

func (*Connection) Listgroup

func (c *Connection) Listgroup(f func(num int64), args interface{}) (err error)

EXPERIMENTAL, MAY CHANGE! Performs the LISTGROUP command.

func (*Connection) PostOrIhave

func (c *Connection) PostOrIhave(msgid []byte, f Posting) (err error)

func (*Connection) Takethis

func (c *Connection) Takethis(msgid []byte, f Posting) (code int, err error)

Posts an article using the TAKETHIS command. Requires RFC-4644 (The STREAMING Extension)

func (*Connection) Xover

func (c *Connection) Xover(f XoverResp, msgno []byte) (err error)

Performs the XOVER command.

type ErrNum

type ErrNum int
const (
	EMalformedResponse ErrNum = iota
	EInvalidArgs
)

func (ErrNum) Error

func (e ErrNum) Error() (s string)

type Posting

type Posting func(dw *fastnntp.DotWriter)

type UnexpectedCode

type UnexpectedCode struct {
	Expected string
	Got      string
}

func (*UnexpectedCode) Error

func (u *UnexpectedCode) Error() string

type XoverResp

type XoverResp func(num int64, subject, from, date, msgId, refs []byte, lng, lines int64)

Jump to

Keyboard shortcuts

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