nntpclient

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 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 {
	// contains filtered or unexported fields
}

Client is an NNTP client.

func New

func New(ctx context.Context, network, addr string) (*Client, error)

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) 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) SetContext

func (c *Client) SetContext(ctx context.Context) func()

func (*Client) SetDeadline

func (c *Client) SetDeadline(t time.Time) error

Jump to

Keyboard shortcuts

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