Documentation ¶
Index ¶
Constants ¶
const ( Unknown = PostingStatus(0) PostingPermitted = PostingStatus('y') PostingNotPermitted = PostingStatus('n') PostingModerated = PostingStatus('m') )
PostingStatus values.
Variables ¶
var ErrAuthRejected = &NNTPError{452, "authorization rejected"}
ErrAuthRejected is returned for invalid authentication.
var ErrAuthRequired = &NNTPError{450, "authorization required"}
ErrAuthRequired is returned to indicate authentication is required to proceed.
var ErrInvalidArticleNumber = &NNTPError{423, "No article with that number"}
ErrInvalidArticleNumber is returned when an article is requested that can't be found.
var ErrInvalidMessageID = &NNTPError{430, "No article with that message-id"}
ErrInvalidMessageID is returned when a message is requested that can't be found.
var ErrNoCurrentArticle = &NNTPError{420, "Current article number is invalid"}
ErrNoCurrentArticle is returned when a command is executed that requires a current article when one has not been selected.
var ErrNoGroupSelected = &NNTPError{412, "No newsgroup selected"}
ErrNoSuchGroup is returned for a request that requires a current group when none has been selected.
var ErrNoSuchGroup = &NNTPError{411, "No such newsgroup"}
ErrNoSuchGroup is returned for a request for a group that can't be found.
var ErrNotAuthenticated = &NNTPError{480, "authentication required"}
ErrNotAuthenticated is returned when a command is issued that requires authentication, but authentication was not provided.
var ErrNotMod = &NNTPError{Code: 441, Msg: "Not moderator"}
var ErrNotWanted = &NNTPError{435, "Article not wanted"}
ErrNotWanted is returned when an attempt to post an article is rejected due the server not wanting the article.
var ErrPostingFailed = &NNTPError{441, "posting failed"}
ErrPostingFailed is returned when an attempt to post an article fails.
var ErrPostingNotPermitted = &NNTPError{440, "Posting not permitted"}
ErrPostingNotPermitted is returned as the response to an attempt to post an article where posting is not permitted.
var ErrPostingTooLarge = &NNTPError{441, "posting large article"}
var ErrServerBad = &NNTPError{500, "Server bad"}
var ErrSyntax = &NNTPError{501, "not supported, or syntax error"}
ErrSyntax is returned when a command can't be parsed.
var ErrUnknownCommand = &NNTPError{500, "Unknown command"}
ErrUnknownCommand is returned for unknown comands.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { // The article's headers Header textproto.MIMEHeader // The article's body Body io.Reader // Number of bytes in the article body (used by OVER/XOVER) Bytes int // Number of lines in the article body (used by OVER/XOVER) Lines int RemoteAddr net.Addr }
An Article that may appear in one or more groups.
type Backend ¶
type Backend interface { ListGroups(max int) ([]*Group, error) GetGroup(name string) (*Group, error) GetArticle(group *Group, id string, headerOnly bool) (*Article, error) GetArticles(group *Group, from, to int64, headerOnly bool) ([]NumberedArticle, error) // Authorized() bool // Authenticate and optionally swap out the backend for this session. // You may return nil to continue using the same backend. Authenticate(user, pass string) (Backend, error) AllowPost() bool Post(article *Article) error }
The Backend that provides the things and does the stuff.
type Group ¶
type Group struct { Name string Description string Count int64 High int64 Low int64 Posting PostingStatus }
Group represents a usenet newsgroup.
type NumberedArticle ¶
A NumberedArticle provides local sequence nubers to articles When listing articles in a group.
type PostingStatus ¶
type PostingStatus byte
PostingStatus type for groups.
func (PostingStatus) String ¶
func (ps PostingStatus) String() string
type Server ¶
type Server struct { // Handlers are dispatched by command name. Handlers map[string]Handler // The backend (your code) that provides data Backend Backend ThrotCmdInterval time.Duration ThrotCmdWindow time.Duration // contains filtered or unexported fields }
The Server handle.
Directories ¶
Path | Synopsis |
---|---|
common/dateparse
Package dateparse parses date-strings without knowing the format in advance, using a fast lex based approach to eliminate shotgun attempts.
|
Package dateparse parses date-strings without knowing the format in advance, using a fast lex based approach to eliminate shotgun attempts. |