nntp

package module
v0.0.0-...-1e450e2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2015 License: AGPL-3.0 Imports: 4 Imported by: 0

README

GoDoc Build Status

Work in progress - this code doesn't work yet.

This repo contains more of a thought experiment about a good interface for a Golang NNTP package.

Install via go get:

go get github.com/diocles/nntp

Documentation

Overview

Package nntp provides the very beginning of an NNTP server implementation.

Index

Constants

View Source
const (
	StatusHelpText       = 100
	StatusCapabilityList = 101
	StatusServerDate     = 111

	StatusPostingAllowed       = 200
	StatusPostingProhibited    = 201
	StatusConnectionClosing    = 205
	StatusGroupSelected        = 211
	StatusInformationFollows   = 215
	StatusArticleFollows       = 220
	StatusArticleHeadersFollow = 221
	StatusArticleBodyFollows   = 222
	StatusArticleSelected      = 223
	StatusOverviewFollows      = 224
	StatusHeadersFollow        = 225
	StatusNewArticlesFollow    = 230
	StatusNewNewsgroupsFollow  = 231
	StatusArticleTransferredOK = 235
	StatusArticleReceivedOK    = 240

	StatusTransferArticle = 335
	StatusPostArticle     = 340

	StatusServiceNotAvailable   = 400
	StatusWrongServerMode       = 401
	StatusInternalFault         = 403
	StatusNoSuchGroup           = 411
	StatusNoGroupSelected       = 412
	StatusCurrentArticleInvalid = 420
	StatusNoNextArticle         = 421
	StatusNoPreviousArticle     = 422
	StatusNoSuchArticleNumber   = 423
	StatusNoSuchMessageID       = 430
	StatusArticleNotWanted      = 435
	StatusTransferFailed        = 436
	StatusTransferRejected      = 437
	StatusPostingNotPermitted   = 440
	StatusPostingFailed         = 441
	StatusNotAuthenticated      = 480
	StatusNotPrivate            = 483

	StatusUnknownCommand      = 500
	StatusSyntaxError         = 501
	StatusNotPermitted        = 502
	StatusFeatureNotSupported = 503
	StatusEncodingError       = 504
)

NNTP status codes as defined by RFC 3977.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
}

A Client is an NNTP client.

type Command

type Command struct {
	// Keyword specifies the type of command.
	Keyword string

	// Args are the arguments to the command.
	Args []string
}

A Command represents an NNTP command received by a server or issued by a client.

func ReadCommand

func ReadCommand(b *bufio.Reader) (com *Command, err error)

ReadCommand reads and parses an incoming command from b.

type Handler

type Handler interface {
	ServeNNTP(ResponseWriter, *Command)
}

A Handler can be registered to serve a particular group hierarchy in the NNTP server.

type ResponseWriter

type ResponseWriter interface {
	// Write writes the data to the connection as part of an NNTP
	// reply.  If WriteHeader has not yet been called, Write calls
	// WriteHeader(nntp.StatusOK) before writing the data.
	Write([]byte) (int, error)

	// WriteHeader sends an NNTP response header with status code.
	// If WriteHeader is not called explicitly, the first call to Write
	// will trigger an implicit WriteHeader(nntp.StatusInternalFault).
	WriteHeader(int)
}

A ResponseWriter interface is used by an NNTP handler to construct an NNTP response.

type Server

type Server struct {
}

A Server represents an NNTP server.

Directories

Path Synopsis
Package nntptest provides utilities for NNTP testing.
Package nntptest provides utilities for NNTP testing.

Jump to

Keyboard shortcuts

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