nntpclient

package
v0.0.0-...-35034e0 Latest Latest
Warning

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

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

Documentation

Overview

Package nntpclient provides an NNTP Client.

Index

Constants

View Source
const (
	OverHeaderSubject    = OverHeader('s')
	OverHeaderFrm        = OverHeader('f')
	OverHeaderXRefFull   = OverHeader('x')
	OverHeaderDate       = OverHeader('d')
	OverHeaderMsgId      = OverHeader('m')
	OverHeaderReferences = OverHeader('r')
	OverHeaderBytes      = OverHeader('b')
	OverHeaderLines      = OverHeader('l')
)
View Source
const (
	SHORT_RFC1123  = "Mon, 02 Jan 06 15:04:05 MST"
	SHORT_RFC1123Z = "Mon, 02 Jan 06 15:04:05 -0700" // RFC1123 with numeric zone
)

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 NewConn

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

NewConn wraps an existing connection, for example one opened with tls.Dial

func NewSsl

func NewSsl(net string, add string, tlsConfig *tls.Config) (*Client, error)

New connects a client to an NNTP server using tls

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

func (c *Client) Capabilities() ([]string, error)

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

func (c *Client) Over(start int64, end int64) ([]*nntp.ArticleOverview, 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(start int64, end int64) ([]*nntp.ArticleOverview, error)

type OverHeader

type OverHeader byte

Jump to

Keyboard shortcuts

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