Documentation ¶
Index ¶
- Constants
- Variables
- func AcquireBufferedWriter(w io.Writer) (bw *bufio.Writer)
- func AppendUint(dst []byte, n int64) []byte
- func ParseRange(src []byte) (int64, int64)
- func ParseUint(src []byte) (i int64)
- func ReleaseBufferedWriter(bw *bufio.Writer)
- type Article
- type ArticleCaps
- type ArticleRange
- type DotReader
- type DotWriter
- type Group
- type GroupCaps
- type GroupListingCaps
- type Handler
- type HeadBodyWriter
- type IListActive
- type IOverview
- type ListActive
- func (ov *ListActive) GetListActiveMode() ListActiveMode
- func (ov *ListActive) WriteActive(group []byte, high, low int64, status byte) error
- func (ov *ListActive) WriteFullInfo(group []byte, high, low int64, status byte, description []byte) error
- func (ov *ListActive) WriteNewsgroups(group []byte, description []byte) error
- type ListActiveMode
- type LoginCaps
- type LoginPriv
- type NNTPError
- type Overview
- type PostingCaps
- type Reader
- type WildMat
- type WildMatRuleSet
Constants ¶
const ( LAM_Full = ListActiveMode(iota) LAM_Active LAM_Newsgroups )
Variables ¶
var DefaultCaps = new(defCaps)
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 ErrIHaveFailed = &NNTPError{436, "Transfer failed; try again later"}
ErrIHaveFailed is returned when an attempt to ihave an article fails AFTER the transfer of the article.
var ErrIHaveNotPossible = &NNTPError{436, "Transfer not possible; try again later"}
ErrIHaveNopPossible is the same as ErrIHaveFailed, except the text. ErrIHaveNopPossible is returned when an attempt to ihave an article fails BEFORE the transfer of the article.
var ErrIHaveRejected = &NNTPError{437, "Transfer rejected; do not retry"}
ErrIHaveRejected is returned when an attempt to ihave an article is rejected due the server not wanting the article.
var ErrInvalidArticleNumber = &NNTPError{423, "No article with that number"}
ErrInvalidArticleNumber is returned when an article is requested that can't be found.
var ErrInvalidArticleRange = &NNTPError{423, "No articles in that range"}
ErrInvalidArticleNumber with other text
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 ErrNoNextArticle = &NNTPError{421, "No next article to retrieve"}
ErrNoNextArticle is returned when LAST or NEXT reaches the end of its iteration
var ErrNoPreviousArticle = &NNTPError{422, "No previous article to retrieve"}
ErrNoPreviousArticle is returned when LAST or NEXT reaches the end of its iteration
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 ErrNotWanted = &NNTPError{435, "Article not wanted"}
ErrNotWanted is returned when an attempt to ihave 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 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 ¶
func AppendUint ¶
func ParseRange ¶
func ReleaseBufferedWriter ¶
Types ¶
type ArticleCaps ¶
type ArticleRange ¶
type DotWriter ¶
type DotWriter struct {
// contains filtered or unexported fields
}
A io.Writer-Wrapper, that enables dot-line ended content to be written. After the final ".\r\n", any further content is discarded. The final ".\r\n" is addedd, if the content didn't contain any.
func AcquireDotWriter ¶
func AcquireDotWriter() *DotWriter
type GroupListingCaps ¶
type GroupListingCaps interface { // Performs a List-Active action. // the argument 'wm' may be nil. ListGroups(wm *WildMat, ila IListActive) bool }
type Handler ¶
type Handler struct { GroupCaps ArticleCaps PostingCaps GroupListingCaps LoginCaps }
type HeadBodyWriter ¶
type HeadBodyWriter struct {
// contains filtered or unexported fields
}
A Writer for postings that consist of a Head and a Body.
Here is an example, of what kind of message will be split into Head and Body:
Subject: This is the head Message-ID: Blubb blubb From: Hugo Meyer <h.meyer@example.org> This is the 1. line of the Body. This is the 2. line of the Body. ... This is the last line of the Body. . (trailing <CRLF>.<CRLF>)
func AcquireHeadBodyWriter ¶
func AcquireHeadBodyWriter() *HeadBodyWriter
func (*HeadBodyWriter) Release ¶
func (w *HeadBodyWriter) Release()
func (*HeadBodyWriter) Reset ¶
func (w *HeadBodyWriter) Reset(head, body io.Writer)
type IListActive ¶
type IListActive interface { GetListActiveMode() ListActiveMode // This function may be used if, and only if GetListActiveMode() returns LAM_Active WriteActive(group []byte, high, low int64, status byte) error // This function may be used if, and only if GetListActiveMode() returns LAM_Newsgroups WriteNewsgroups(group []byte, description []byte) error WriteFullInfo(group []byte, high, low int64, status byte, description []byte) error }
type ListActive ¶
type ListActive struct {
// contains filtered or unexported fields
}
func (*ListActive) GetListActiveMode ¶
func (ov *ListActive) GetListActiveMode() ListActiveMode
func (*ListActive) WriteActive ¶
func (ov *ListActive) WriteActive(group []byte, high, low int64, status byte) error
func (*ListActive) WriteFullInfo ¶
func (*ListActive) WriteNewsgroups ¶
func (ov *ListActive) WriteNewsgroups(group []byte, description []byte) error
type ListActiveMode ¶
type ListActiveMode int
type LoginCaps ¶
type LoginCaps interface { // This Method SHOULD return true, if authentication has already occurred. AuthinfoDone(h *Handler) bool // Checks a privilege. Returns true if it is allowed. AuthinfoCheckPrivilege(p LoginPriv, h *Handler) bool // This Method returns true, if the combination of username is accepted without password. // The method can optionally return a new Handler object in place of the old one. AuthinfoUserOny(user []byte, oldh *Handler) (bool, *Handler) // This Method returns true, if the combination of username and password is accepted. AuthinfoUserPass(user, password []byte, oldh *Handler) (bool, *Handler) }
NNTP Authentication. Documented outside RFC 3977 --> RFC 4643
type PostingCaps ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
A reader.
func AcquireReader ¶
func AcquireReader() *Reader
type WildMat ¶
type WildMat struct {
RuleSets []*WildMatRuleSet
}
func ParseWildMat ¶
func ParseWildMatBinary ¶
func (*WildMat) MatchString ¶
type WildMatRuleSet ¶
type WildMatRuleSet struct { Positive []string Negative []string PR *regexp.Regexp NR *regexp.Regexp }
func (*WildMatRuleSet) Compile ¶
func (wmrs *WildMatRuleSet) Compile() (e error)
func (*WildMatRuleSet) Match ¶
func (wmrs *WildMatRuleSet) Match(s []byte) bool
func (*WildMatRuleSet) MatchString ¶
func (wmrs *WildMatRuleSet) MatchString(s string) bool