Documentation
¶
Overview ¶
Package nntpserver provides everything you need for your own NNTP server.
Index ¶
- Constants
- Variables
- type Article
- type Backend
- type DiskBackend
- func (b *DiskBackend) AllowPost() bool
- func (b *DiskBackend) Authenticate(user, pass string) (Backend, error)
- func (b *DiskBackend) Authorized() bool
- func (b *DiskBackend) Close() error
- func (b *DiskBackend) GetArticle(group *Group, id string) (*Article, error)
- func (b *DiskBackend) GetArticles(group *Group, from, to int64) ([]NumberedArticle, error)
- func (b *DiskBackend) GetGroup(name string) (*Group, error)
- func (b *DiskBackend) ListGroups(max int) ([]*Group, error)
- func (b *DiskBackend) Post(article *Article) error
- func (b *DiskBackend) Stat(group *Group, id string) (string, string, error)
- type Group
- type Handler
- type NNTPError
- type NumberedArticle
- type PostingStatus
- type Server
Constants ¶
View Source
const ( DefaultDBPath = "nntp.db" ArticleNumberKey = "article_number" )
View Source
const ( Unknown = PostingStatus(0) PostingPermitted = PostingStatus('y') PostingNotPermitted = PostingStatus('n') PostingModerated = PostingStatus('m') )
PostingStatus values.
Variables ¶
View Source
var ErrAuthRejected = &NNTPError{452, "authorization rejected"}
View Source
var ErrAuthRequired = &NNTPError{450, "authorization required"}
View Source
var ErrInvalidArticleNumber = &NNTPError{423, "No article with that number"}
View Source
var ErrInvalidMessageID = &NNTPError{430, "No article with that message-id"}
View Source
var ErrNoCurrentArticle = &NNTPError{420, "Current article number is invalid"}
View Source
var ErrNoGroupSelected = &NNTPError{412, "No newsgroup selected"}
View Source
var ErrNoSuchGroup = &NNTPError{411, "No such newsgroup"}
View Source
var ErrNotAuthenticated = &NNTPError{480, "authentication required"}
View Source
var ErrNotWanted = &NNTPError{435, "Article not wanted"}
View Source
var ErrPostingFailed = &NNTPError{441, "posting failed"}
View Source
var ErrPostingNotPermitted = &NNTPError{440, "Posting not permitted"}
View Source
var ErrSyntax = &NNTPError{501, "not supported, or syntax error"}
View Source
var ErrUnknownCommand = &NNTPError{500, "Unknown command"}
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { ListGroups(max int) ([]*Group, error) GetGroup(name string) (*Group, error) GetArticle(group *Group, id string) (*Article, error) GetArticles(group *Group, from, to int64) ([]NumberedArticle, error) Authorized() bool Authenticate(user, pass string) (Backend, error) AllowPost() bool Post(article *Article) error Stat(group *Group, id string) (string, string, error) }
type DiskBackend ¶
type DiskBackend struct {
// contains filtered or unexported fields
}
func NewDiskBackend ¶
func NewDiskBackend( cleanOnClose bool, dbPath string, ) *DiskBackend
func (*DiskBackend) AllowPost ¶
func (b *DiskBackend) AllowPost() bool
func (*DiskBackend) Authenticate ¶
func (b *DiskBackend) Authenticate(user, pass string) (Backend, error)
func (*DiskBackend) Authorized ¶
func (b *DiskBackend) Authorized() bool
func (*DiskBackend) Close ¶
func (b *DiskBackend) Close() error
func (*DiskBackend) GetArticle ¶
func (b *DiskBackend) GetArticle(group *Group, id string) (*Article, error)
func (*DiskBackend) GetArticles ¶
func (b *DiskBackend) GetArticles(group *Group, from, to int64) ([]NumberedArticle, error)
func (*DiskBackend) ListGroups ¶
func (b *DiskBackend) ListGroups(max int) ([]*Group, error)
func (*DiskBackend) Post ¶
func (b *DiskBackend) Post(article *Article) error
type NumberedArticle ¶
type PostingStatus ¶
type PostingStatus byte
PostingStatus type for groups.
func (PostingStatus) String ¶
func (ps PostingStatus) String() string
Click to show internal directories.
Click to hide internal directories.