The Central Go Modules Repository

To use GoCenter:
export GOPROXY=
March 11th 2019
Last Modified


– import “”


const (
	ArticleFound    = 220
	NoArticleWithId = 430
const (
	AuthAccepted   = 281
	PasswordNeeded = 381
	AuthNeeded     = 480
	BadAuth        = 481
	ConnsExceeded  = 502

const (
	GroupJoined = 211
	NoSuchGroup = 411
const (
	CapabilitiesFollow = 101
const HeadersFollow = 221
const (
	InfoFollows = 215
var (
	TooManyConns = ConnErr{ConnsExceeded, "too many connections"}
	AuthRejected = ConnErr{BadAuth, "credentials rejected"}
var (
	IllegalResponse = fmt.Errorf("illegal response")
	IllegalHeader   = fmt.Errorf("illegal headers")

type Client

type Client struct {
	MaxConns, Port     int
	Server, User, Pass string
	Tls                bool

func NewClient

func NewClient(server string, port int) *Client

func (*Client) Auth

func (cli *Client) Auth(u, p string) error

func (*Client) Capabilities

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

func (*Client) Do

func (cli *Client) Do(format string, args ...interface{}) (*Response, error)

func (*Client) GetArticle

func (cli *Client) GetArticle(group, id string) (res *Response, err error)

Client method GetArticle

func (*Client) Head

func (cli *Client) Head(group, id string) (*Response, error)

func (*Client) JoinGroup

func (cli *Client) JoinGroup(name string) error

func (*Client) List

func (cli *Client) List() ([]Group, error)

func (*Client) ListGroup

func (cli *Client) ListGroup(gid string) ([]string, error)

func (*Client) SetMaxConns

func (cli *Client) SetMaxConns(n int)

type Conn

type Conn struct {

func NewConn

func NewConn(c io.ReadWriteCloser, wrappers ...func(io.Reader) io.Reader) *Conn

func (*Conn) Auth

func (conn *Conn) Auth(u, p string) error

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Do

func (c *Conn) Do(format string, is ...interface{}) (*Response, error)

func (*Conn) Wrap

func (c *Conn) Wrap(fn ...func(io.Reader) io.Reader)

type ConnErr

type ConnErr struct {
	Code   int    `json:"code"xml:"code"`
	Reason string `json:"reason"xml:"reason"`

func (ConnErr) Error

func (c ConnErr) Error() string

type Group

type Group struct {
	Id           string
	Count, First int

type Reader

type Reader struct {
	R *bufio.Reader

A Reader is a read/closer that strips NNTP newlines and will unescape characters.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns an nntp.Reader for the body of the nttp article.

func (*Reader) Close

func (r *Reader) Close() error

Close allows users of a Reader to signal that they are done using the reader.

func (*Reader) Read

func (r *Reader) Read(p []byte) (bytesRead int, err error)

The Read method handles translation of the NNTP escaping and marking EOF when the end of a body is received.

type Response

type Response struct {
	Code    int                  `json:"code"xml:"code"`
	Message string               `json:"message"xml:"message"`
	Headers textproto.MIMEHeader `json:"headers"xml:"headers"`
	Body    io.ReadCloser        `json:"body"xml:"body"` //Presence (non-nil) indicates multi-line response

func NewResponse

func NewResponse(r io.Reader) (*Response, error)