nntpclient

package
v0.0.0-...-132b406 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package nntpclient provides an NNTP Client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an NNTP client.

func New

func New(net, addr string) (*Client, error)

New connects a client to an NNTP server.

func (*Client) Article

func (c *Client) Article(specifier string) (int64, string, io.Reader, error)

Article grabs an article

func (*Client) Authenticate

func (c *Client) Authenticate(user, pass string) (msg string, err error)

Authenticate against an NNTP server using authinfo user/pass

func (*Client) Body

func (c *Client) Body(specifier string) (int64, string, io.Reader, error)

Body gets the body of an article

func (*Client) Close

func (c *Client) Close() error

Close this client.

func (*Client) Command

func (c *Client) Command(cmd string, expectCode int) (int, string, error)

Command sends a low-level command and get a response.

This will return an error if the code doesn't match the expectCode prefix. For example, if you specify "200", the response code MUST be 200 or you'll get an error. If you specify "2", any code from 200 (inclusive) to 300 (exclusive) will be success. An expectCode of -1 disables this behavior.

func (*Client) Group

func (c *Client) Group(name string) (rv nntp.Group, err error)

Group selects a group.

func (*Client) Head

func (c *Client) Head(specifier string) (int64, string, io.Reader, error)

Head gets the headers for an article

func (*Client) List

func (c *Client) List(sub string) (rv []nntp.Group, err error)

List groups

func (*Client) MultilineCommand

func (c *Client) MultilineCommand(cmd string, expectCode int) (int, []string, error)

func (*Client) Post

func (c *Client) Post(r io.Reader) error

Post a new article

The reader should contain the entire article, headers and body in RFC822ish format.

func (*Client) XOver

func (c *Client) XOver(specifier string, compress bool) (<-chan Overview, error)

XOver issues the XOVER verb across the range of messages specified in specifier. If compress is true, the XZVER verb will be used instead.

type Overview

type Overview struct {
	Headers textproto.MIMEHeader
	Err     error
}

Jump to

Keyboard shortcuts

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