Documentation ¶
Overview ¶
Package nntpclient provides an NNTP Client.
Index ¶
- type Client
- func (c *Client) Article(specifier string) (int64, string, io.Reader, error)
- func (c *Client) Authenticate(user, pass string) (msg string, err error)
- func (c *Client) Body(specifier string) (int64, string, io.Reader, error)
- func (c *Client) Capabilities() ([]string, error)
- func (c *Client) Close() error
- func (c *Client) Command(cmd string, expectCode int) (int, string, error)
- func (c *Client) GetCapability(capability string) string
- func (c *Client) Group(name string) (rv nntp.Group, err error)
- func (c *Client) HasCapabilityArgument(capability, argument string) (bool, error)
- func (c *Client) HasTLS() bool
- func (c *Client) Head(specifier string) (int64, string, io.Reader, error)
- func (c *Client) List(sub string) (rv []nntp.Group, err error)
- func (c *Client) ListOverviewFmt() ([]string, error)
- func (c *Client) Over(specifier string) ([]string, error)
- func (c *Client) Post(r io.Reader) error
- func (c *Client) StartTLS(config *tls.Config) error
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 (*Client) Authenticate ¶
Authenticate against an NNTP server using authinfo user/pass
func (*Client) Capabilities ¶
Capabilities retrieves a list of supported capabilities.
See https://datatracker.ietf.org/doc/html/rfc3977#section-5.2.2
func (*Client) Command ¶
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) GetCapability ¶
GetCapability returns a complete capability line.
"Each capability line consists of one or more tokens, which MUST be separated by one or more space or TAB characters."
From https://datatracker.ietf.org/doc/html/rfc3977#section-3.3.1
func (*Client) HasCapabilityArgument ¶
HasCapabilityArgument indicates whether a capability arg is supported.
Here, "argument" means any token after the label in a capabilities response line. Some, like "ACTIVE" in "LIST ACTIVE", are not command arguments but rather "keyword" components of compound commands called "variants."
See https://datatracker.ietf.org/doc/html/rfc3977#section-9.5
func (*Client) ListOverviewFmt ¶
ListOverviewFmt performs a LIST OVERVIEW.FMT query.
According to the spec, the presence of an "OVER" line in the capabilities response means this LIST variant is supported, so there's no reason to check for it among the keywords in the "LIST" line, strictly speaking.
See https://datatracker.ietf.org/doc/html/rfc3977#section-3.3.2