Documentation
¶
Overview ¶
daemon.go
database.go
expiration.go content expiration
frontend.go srnd frontend interfaces
frontend_http.go
srnd http frontend implementation
markup.go memeposting markup parser
message.go
mod.go post moderation
model.go template model implementation
nntp.go -- nntp interface for peering
policy.go
postgres db backend
templates.go template model interfaces
tls.go -- tls related functions
tools.go -- srndv2 cli tool functions
Index ¶
- func CheckConfig()
- func CheckFile(fname string) bool
- func DelFile(fname string)
- func EnsureDir(dirname string)
- func GenFeedsConfig() error
- func GenSRNdConfig() error
- func HashMessageID(msgid string) string
- func IsDir(dirname string) bool
- func NewLineWriter(wr io.Writer, delim string) io.Writer
- func OpenFileWriter(fname string) (io.WriteCloser, error)
- func RunModEngine(mod ModEngine, regen RegenFunc)
- func ShortHashMessageID(msgid string) string
- func ThumbnailTool()
- func ValidMessageID(id string) bool
- func Version() string
- type APIConfig
- type AdminFunc
- type ArticleEntry
- type ArticleHeaders
- type ArticleStore
- type AttachmentModel
- type AttachmentSaver
- type BaseModel
- type BoardModel
- type Database
- type ExpirationCore
- type FeedConfig
- type FeedPolicy
- type Frontend
- type GroupModel
- type LinkModel
- type MessageReader
- type MessageWriter
- type ModEngine
- type ModEvent
- type ModMessage
- type ModUI
- type NNTPAttachment
- type NNTPDaemon
- type NNTPMessage
- type NavbarModel
- type PostModel
- type PostgresDatabase
- func (self PostgresDatabase) AddModPubkey(pubkey string) error
- func (self PostgresDatabase) ArticleBanned(messageID string) (result bool)
- func (self PostgresDatabase) ArticleCount() (count int64)
- func (self PostgresDatabase) BanAddr(addr string) (err error)
- func (self PostgresDatabase) BanArticle(messageID, reason string) error
- func (self PostgresDatabase) BanEncAddr(encaddr string) (err error)
- func (self PostgresDatabase) BanNewsgroup(group string) (err error)
- func (self PostgresDatabase) CheckEncIPBanned(encaddr string) (banned bool, err error)
- func (self PostgresDatabase) CheckIPBanned(addr string) (banned bool, err error)
- func (self PostgresDatabase) CheckModPubkey(pubkey string) bool
- func (self PostgresDatabase) CheckModPubkeyCanModGroup(pubkey, newsgroup string) bool
- func (self PostgresDatabase) CheckModPubkeyGlobal(pubkey string) bool
- func (self PostgresDatabase) Close()
- func (self PostgresDatabase) CountPostsInGroup(newsgroup string, time_frame int64) (result int64)
- func (self PostgresDatabase) CountThreadReplies(root_message_id string) (repls int64)
- func (self PostgresDatabase) CreateTables()
- func (self PostgresDatabase) DeleteArticle(msgid string) (err error)
- func (self PostgresDatabase) DeleteThread(msgid string) (err error)
- func (self PostgresDatabase) GetAllArticles() (articles []ArticleEntry)
- func (self PostgresDatabase) GetAllArticlesInGroup(group string, recv chan ArticleEntry)
- func (self PostgresDatabase) GetAllNewsgroups() (groups []string)
- func (self PostgresDatabase) GetEncAddress(addr string) (encaddr string, err error)
- func (self PostgresDatabase) GetEncKey(encAddr string) (enckey string, err error)
- func (self PostgresDatabase) GetGroupForMessage(message_id string) (group string, err error)
- func (self PostgresDatabase) GetGroupForPage(prefix, frontend, newsgroup string, pageno, perpage int) BoardModel
- func (self PostgresDatabase) GetGroupPageCount(newsgroup string) int64
- func (self PostgresDatabase) GetGroupThreads(group string, recv chan ArticleEntry)
- func (self PostgresDatabase) GetIPAddress(encaddr string) (addr string, err error)
- func (self PostgresDatabase) GetInfoForMessage(msgid string) (root string, newsgroup string, page int64, err error)
- func (self PostgresDatabase) GetLastAndFirstForGroup(group string) (last, first int64, err error)
- func (self PostgresDatabase) GetLastBumpedThreads(newsgroup string, threads int) (roots []ArticleEntry)
- func (self PostgresDatabase) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
- func (self PostgresDatabase) GetMessageIDForNNTPID(group string, id int64) (msgid string, err error)
- func (self PostgresDatabase) GetPageForRootMessage(root_message_id string) (group string, page int64, err error)
- func (self PostgresDatabase) GetPagesPerBoard(group string) (int, error)
- func (self PostgresDatabase) GetPostAttachmentModels(prefix, messageID string) (atts []AttachmentModel)
- func (self PostgresDatabase) GetPostAttachments(messageID string) (atts []string)
- func (self PostgresDatabase) GetPostModel(prefix, messageID string) PostModel
- func (self PostgresDatabase) GetPostsInGroup(newsgroup string) (models []PostModel, err error)
- func (self PostgresDatabase) GetRootPostsForExpiration(newsgroup string, threadcount int) (roots []string)
- func (self PostgresDatabase) GetThreadReplies(rootpost string, limit int) (repls []string)
- func (self PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string, limit int) (repls []PostModel)
- func (self PostgresDatabase) GetThreadsPerPage(group string) (int, error)
- func (self PostgresDatabase) GroupHasPosts(group string) bool
- func (self PostgresDatabase) HasArticle(message_id string) bool
- func (self PostgresDatabase) HasArticleLocal(message_id string) bool
- func (self PostgresDatabase) HasNewsgroup(group string) bool
- func (self PostgresDatabase) IsExpired(root_message_id string) bool
- func (self PostgresDatabase) MarkModPubkeyCanModGroup(pubkey, group string) (err error)
- func (self PostgresDatabase) MarkModPubkeyGlobal(pubkey string) (err error)
- func (self PostgresDatabase) NewsgroupBanned(group string) (banned bool, err error)
- func (self PostgresDatabase) NukeNewsgroup(group string, store ArticleStore)
- func (self PostgresDatabase) RegisterArticle(message NNTPMessage)
- func (self PostgresDatabase) RegisterNewsgroup(group string)
- func (self PostgresDatabase) RegisterSigned(message_id, pubkey string) (err error)
- func (self PostgresDatabase) ThreadHasReplies(rootpost string) bool
- func (self PostgresDatabase) UnMarkModPubkeyCanModGroup(pubkey, group string) (err error)
- func (self PostgresDatabase) UnMarkModPubkeyGlobal(pubkey string) (err error)
- func (self PostgresDatabase) UnbanAddr(addr string) (err error)
- func (self PostgresDatabase) UnbanNewsgroup(group string) (err error)
- type RegenFunc
- type SRNdConfig
- type ThreadModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenFileWriter ¶
func OpenFileWriter(fname string) (io.WriteCloser, error)
func RunModEngine ¶
run a mod engine logic mainloop
Types ¶
type ArticleEntry ¶
type ArticleEntry [2]string
a ( MessageID , newsgroup ) tuple
func (ArticleEntry) MessageID ¶
func (self ArticleEntry) MessageID() string
func (ArticleEntry) Newsgroup ¶
func (self ArticleEntry) Newsgroup() string
type ArticleHeaders ¶
func (ArticleHeaders) Get ¶
func (self ArticleHeaders) Get(key, fallback string) string
func (ArticleHeaders) Has ¶
func (self ArticleHeaders) Has(key string) bool
func (ArticleHeaders) Set ¶
func (self ArticleHeaders) Set(key, val string)
type ArticleStore ¶
type ArticleStore interface { MessageReader MessageWriter // get the filepath for an attachment AttachmentFilepath(fname string) string // get the filepath for an attachment's thumbnail ThumbnailFilepath(fname string) string // do we have this article? HasArticle(msgid string) bool // create a file for a message CreateFile(msgid string) io.WriteCloser // create a file for a temp message, returns nil if it's already open CreateTempFile(msgid string) io.WriteCloser // get the filename of a message GetFilename(msgid string) string // get the filename of a temp message GetTempFilename(msgid string) string // Get a message given its messageid GetMessage(msgid string) NNTPMessage // get a temp message given its messageid // temp message is deleted once read ReadTempMessage(msgid string) NNTPMessage // store a post StorePost(nntp NNTPMessage) error // get article headers only GetHeaders(msgid string) ArticleHeaders // get our temp directory for articles TempDir() string // get a list of all the attachments we have GetAllAttachments() ([]string, error) // generate a thumbnail GenerateThumbnail(fname string) error }
type AttachmentModel ¶
for attachments
type AttachmentSaver ¶
type BaseModel ¶
type BaseModel interface { // site url prefix Prefix() string // render to a writer RenderTo(wr io.Writer) error }
base model type
type BoardModel ¶
type BoardModel interface { BaseModel NavbarModel Frontend() string Name() string Threads() []ThreadModel // JUST update this thread // if we don't have it already loaded do nothing UpdateThread(message_id string, db Database) BoardModel // get a thread model with this id // returns nil if we don't have it GetThread(message_id string) ThreadModel // deprecated, use GetThread HasThread(message_id string) bool // update the board's contents // return the updated model Update(db Database) BoardModel }
board interface for 1 page on a board
type Database ¶
type Database interface { Close() CreateTables() HasNewsgroup(group string) bool HasArticle(message_id string) bool HasArticleLocal(message_id string) bool RegisterNewsgroup(group string) RegisterArticle(article NNTPMessage) GetAllArticlesInGroup(group string, send chan ArticleEntry) GetAllArticles() []ArticleEntry // check if a newsgroup is banned NewsgroupBanned(group string) (bool, error) // ban / unban newsgroup BanNewsgroup(group string) error UnbanNewsgroup(group string) error // delete an entire newsgroup // delete from the article store too NukeNewsgroup(group string, store ArticleStore) // return true if this is root post has expired IsExpired(root_message_id string) bool // get an article's MessageID given the hash of the MessageID // return an article entry or nil when it doesn't exist + and error if it happened GetMessageIDByHash(hash string) (ArticleEntry, error) // get root message_id, newsgroup, pageno for a post regardless if it's rootpost or not GetInfoForMessage(msgid string) (string, string, int64, error) // what page is the thread with this root post on? // return newsgroup, pageno GetPageForRootMessage(root_message_id string) (string, int64, error) // record that a message given a message id was posted signed by this pubkey RegisterSigned(message_id, pubkey string) error // get the number of articles we have ArticleCount() int64 // return true if this thread has any replies ThreadHasReplies(root_message_id string) bool // get the number of posts in a certain newsgroup since N seconds ago // if N <= 0 then count all we have now CountPostsInGroup(group string, time_frame int64) int64 // get all replies to a thread // if last > 0 then get that many of the last replies GetThreadReplies(root_message_id string, last int) []string // count the number of replies to this thread CountThreadReplies(root_message_id string) int64 // get all attachments for this message GetPostAttachments(message_id string) []string // get all attachments for this message GetPostAttachmentModels(prefix, message_id string) []AttachmentModel // return true if this newsgroup has posts GroupHasPosts(newsgroup string) bool // get all active threads on a board // send each thread's ArticleEntry down a channel GetGroupThreads(newsgroup string, send chan ArticleEntry) // get every message id for root posts that need to be expired in a newsgroup // threadcount is the upperbound limit to how many root posts we keep GetRootPostsForExpiration(newsgroup string, threadcount int) []string // get the number of pages a board has GetGroupPageCount(newsgroup string) int64 // get board page number N // prefix and frontend are injected GetGroupForPage(prefix, frontend, newsgroup string, pageno, perpage int) BoardModel // get the root posts of the last N bumped threads in a given newsgroup or globally for ukko GetLastBumpedThreads(newsgroup string, threadcount int) []ArticleEntry // get the PostModels for replies to a thread // prefix is injected into the post models GetThreadReplyPostModels(prefix, rootMessageID string, limit int) []PostModel // get a post model for a post // prefix is injected into the post model GetPostModel(prefix, messageID string) PostModel // add a public key to the database AddModPubkey(pubkey string) error // mark that a mod with this pubkey can act on all boards MarkModPubkeyGlobal(pubkey string) error // revoke mod with this pubkey the privilege of being able to act on all boards UnMarkModPubkeyGlobal(pubkey string) error // check if this mod pubkey can moderate at a global level CheckModPubkeyGlobal(pubkey string) bool // check if a mod with this pubkey has permission to moderate at all CheckModPubkey(pubkey string) bool // check if a mod with this pubkey can moderate on the given newsgroup CheckModPubkeyCanModGroup(pubkey, newsgroup string) bool // add a pubkey to be able to mod a newsgroup MarkModPubkeyCanModGroup(pubkey, newsgroup string) error // remote a pubkey to they can't mod a newsgroup UnMarkModPubkeyCanModGroup(pubkey, newsgroup string) error // ban an article BanArticle(messageID, reason string) error // check if an article is banned or not ArticleBanned(messageID string) bool // Get ip address given the encrypted version // return emtpy string if we don't have it GetIPAddress(encAddr string) (string, error) // check if an ip is banned from our local CheckIPBanned(addr string) (bool, error) // check if an encrypted ip is banned from our local CheckEncIPBanned(encAddr string) (bool, error) // ban an ip address from the local BanAddr(addr string) error // unban an ip address from the local UnbanAddr(addr string) error // ban an encrypted ip address from the remote BanEncAddr(encAddr string) error // return the encrypted version of an IPAddress // if it's not already there insert it into the database GetEncAddress(addr string) (string, error) // get the decryption key for an encrypted address // return empty string if we don't have it GetEncKey(encAddr string) (string, error) // delete an article from the database DeleteArticle(msg_id string) error // detele the existance of a thread from the threads table, does NOT remove replies DeleteThread(root_msg_id string) error // get threads per page for a newsgroup GetThreadsPerPage(group string) (int, error) // get pages per board for a newsgroup GetPagesPerBoard(group string) (int, error) // get every newsgroup we know of GetAllNewsgroups() []string // get all post models in a newsgroup // ordered from oldest to newest GetPostsInGroup(group string) ([]PostModel, error) // get the numerical id of the last , first article for a given group GetLastAndFirstForGroup(group string) (int64, int64, error) // get a message id give a newsgroup and the nntp id GetMessageIDForNNTPID(group string, id int64) (string, error) }
func NewDatabase ¶
func NewPostgresDatabase ¶
type ExpirationCore ¶
type ExpirationCore interface { // do expiration for a group ExpireGroup(newsgroup string, keep int) // Delete a single post and all children DeletePost(messageID string) // run our mainloop Mainloop() }
content expiration interface
type FeedConfig ¶
type FeedConfig struct {
// contains filtered or unexported fields
}
type FeedPolicy ¶
type FeedPolicy struct {
// contains filtered or unexported fields
}
func (*FeedPolicy) AllowsNewsgroup ¶
func (self *FeedPolicy) AllowsNewsgroup(newsgroup string) bool
do we allow this newsgroup?
type Frontend ¶
type Frontend interface { // channel that is for the nntpd to poll for new posts from this frontend NewPostsChan() chan NNTPMessage // channel that is for the frontend to pool for new posts from the nntpd PostsChan() chan NNTPMessage // run mainloop Mainloop() // do we want posts from a newsgroup? AllowNewsgroup(group string) bool // trigger a manual regen of indexes for a root post Regen(msg ArticleEntry) }
frontend interface for any type of frontend
func MuxFrontends ¶
func NewHTTPFrontend ¶
func NewHTTPFrontend(daemon *NNTPDaemon, config map[string]string, url string) Frontend
create a new http based frontend
func NewNNTPFrontend ¶
func NewNNTPFrontend(d *NNTPDaemon, bindaddr string) Frontend
type GroupModel ¶
type GroupModel []BoardModel
newsgroup model every page on a newsgroup
func (GroupModel) Update ¶
func (self GroupModel) Update(page int, db Database) GroupModel
update a certain page does nothing if out of bounds
func (GroupModel) UpdateAll ¶
func (self GroupModel) UpdateAll(db Database) GroupModel
TODO: optimize using 1 query? update every page return updated model
type MessageReader ¶
type MessageReader interface { // read a message from a reader ReadMessage(r io.Reader) (NNTPMessage, error) }
type MessageWriter ¶
type MessageWriter interface { // write a message to a writer WriteMessage(nntp NNTPMessage, wr io.Writer) error }
type ModEngine ¶
type ModEngine interface { // chan to send the mod engine posts // assumes ctl newsgroup only MessageChan() chan NNTPMessage // delete post of a poster DeletePost(msgid string, regen RegenFunc) error // ban a cidr BanAddress(cidr string) error // do we allow this public key to delete? AllowDelete(pubkey string) bool // do we allow this public key to ban? AllowBan(pubkey string) bool }
type ModEvent ¶
type ModEvent interface { // turn it into a string for putting into an article String() string // what type of mod event Action() string // what reason for the event Reason() string // what is the event acting on Target() string // scope of the event, regex of newsgroup Scope() string // when this mod event expires, unix nano Expires() int64 }
func ParseModEvent ¶
type ModMessage ¶
type ModMessage []ModEvent
moderation message wraps multiple mod events is turned into an NNTPMessage later
type ModUI ¶
type ModUI interface { // channel for daemon to poll for nntp articles from the mod ui MessageChan() chan NNTPMessage // check if this key is allowed to access // return true if it can otherwise false CheckKey(privkey string) (bool, error) // serve the base page ServeModPage(wr http.ResponseWriter, r *http.Request) // handle a login POST request HandleLogin(wr http.ResponseWriter, r *http.Request) // handle a delete article request HandleDeletePost(wr http.ResponseWriter, r *http.Request) // handle a ban address request HandleBanAddress(wr http.ResponseWriter, r *http.Request) // handle an unban address request HandleUnbanAddress(wr http.ResponseWriter, r *http.Request) // handle add a pubkey HandleAddPubkey(wr http.ResponseWriter, r *http.Request) // handle removing a pubkey HandleDelPubkey(wr http.ResponseWriter, r *http.Request) // handle key generation HandleKeyGen(wr http.ResponseWriter, r *http.Request) // handle admin command HandleAdminCommand(wr http.ResponseWriter, r *http.Request) }
interface for moderation ui
type NNTPAttachment ¶
type NNTPAttachment interface { // the name of the file Filename() string // the filepath to the saved file Filepath() string // the mime type of the attachment Mime() string // the file extension of the attachment Extension() string // write this attachment out to a writer WriteTo(wr io.Writer) error // get the sha512 hash of the attachment Hash() []byte // do we need to generate a thumbnail? NeedsThumbnail() bool // mime header Header() textproto.MIMEHeader // make into a model ToModel(prefix string) AttachmentModel }
type NNTPDaemon ¶
type NNTPDaemon struct {
// contains filtered or unexported fields
}
func (NNTPDaemon) End ¶
func (self NNTPDaemon) End()
func (NNTPDaemon) Setup ¶
func (self NNTPDaemon) Setup() NNTPDaemon
type NNTPMessage ¶
type NNTPMessage interface { // this message's messsge id MessageID() string // the parent message's messageid if it's specified Reference() string // the newsgroup this post is in Newsgroup() string // the name of the poster Name() string // any email address associated with the post Email() string // the subject of the post Subject() string // when this was posted Posted() int64 // the path header Path() string // append something to path // return message with new path AppendPath(part string) NNTPMessage // the type of this message usually a mimetype ContentType() string // was this post a sage? Sage() bool // was this post a root post? OP() bool // all attachments Attachments() []NNTPAttachment // all headers Headers() ArticleHeaders // write out everything WriteTo(wr io.Writer, delim string) error // write out body WriteBody(wr io.Writer, delim string) error // attach a file Attach(att NNTPAttachment) NNTPMessage // get the plaintext message if it exists Message() string // pack the whole message and prepare for write Pack() // get the inner nntp article that is signed and valid, returns nil if not present or invalid Signed() NNTPMessage // get the pubkey for this message if it was signed, otherwise empty string Pubkey() string // get the origin encrypted address, i2p destination or empty string for onion posters Addr() string }
type PostModel ¶
type PostModel interface { BaseModel CSSClass() string MessageID() string PostHash() string ShortHash() string PostURL() string Frontend() string Subject() string Name() string Date() string OP() bool Attachments() []AttachmentModel Board() string Sage() bool Pubkey() string Reference() string RenderBody() string RenderPost() string IsI2P() bool IsTor() bool IsClearnet() bool // truncate body to a certain size // return copy Truncate() PostModel }
for individual posts
func PostModelFromMessage ¶
func PostModelFromMessage(parent, prefix string, nntp NNTPMessage) PostModel
type PostgresDatabase ¶
type PostgresDatabase struct {
// contains filtered or unexported fields
}
func (PostgresDatabase) AddModPubkey ¶
func (self PostgresDatabase) AddModPubkey(pubkey string) error
func (PostgresDatabase) ArticleBanned ¶
func (self PostgresDatabase) ArticleBanned(messageID string) (result bool)
func (PostgresDatabase) ArticleCount ¶
func (self PostgresDatabase) ArticleCount() (count int64)
count articles we have
func (PostgresDatabase) BanAddr ¶
func (self PostgresDatabase) BanAddr(addr string) (err error)
func (PostgresDatabase) BanArticle ¶
func (self PostgresDatabase) BanArticle(messageID, reason string) error
func (PostgresDatabase) BanEncAddr ¶
func (self PostgresDatabase) BanEncAddr(encaddr string) (err error)
func (PostgresDatabase) BanNewsgroup ¶
func (self PostgresDatabase) BanNewsgroup(group string) (err error)
func (PostgresDatabase) CheckEncIPBanned ¶
func (self PostgresDatabase) CheckEncIPBanned(encaddr string) (banned bool, err error)
func (PostgresDatabase) CheckIPBanned ¶
func (self PostgresDatabase) CheckIPBanned(addr string) (banned bool, err error)
func (PostgresDatabase) CheckModPubkey ¶
func (self PostgresDatabase) CheckModPubkey(pubkey string) bool
func (PostgresDatabase) CheckModPubkeyCanModGroup ¶
func (self PostgresDatabase) CheckModPubkeyCanModGroup(pubkey, newsgroup string) bool
func (PostgresDatabase) CheckModPubkeyGlobal ¶
func (self PostgresDatabase) CheckModPubkeyGlobal(pubkey string) bool
func (PostgresDatabase) Close ¶
func (self PostgresDatabase) Close()
finalize all transactions close database connections
func (PostgresDatabase) CountPostsInGroup ¶
func (self PostgresDatabase) CountPostsInGroup(newsgroup string, time_frame int64) (result int64)
func (PostgresDatabase) CountThreadReplies ¶
func (self PostgresDatabase) CountThreadReplies(root_message_id string) (repls int64)
func (PostgresDatabase) CreateTables ¶
func (self PostgresDatabase) CreateTables()
func (PostgresDatabase) DeleteArticle ¶
func (self PostgresDatabase) DeleteArticle(msgid string) (err error)
func (PostgresDatabase) DeleteThread ¶
func (self PostgresDatabase) DeleteThread(msgid string) (err error)
func (PostgresDatabase) GetAllArticles ¶
func (self PostgresDatabase) GetAllArticles() (articles []ArticleEntry)
get all articles send result down a channel
func (PostgresDatabase) GetAllArticlesInGroup ¶
func (self PostgresDatabase) GetAllArticlesInGroup(group string, recv chan ArticleEntry)
get all articles in a newsgroup send result down a channel
func (PostgresDatabase) GetAllNewsgroups ¶
func (self PostgresDatabase) GetAllNewsgroups() (groups []string)
func (PostgresDatabase) GetEncAddress ¶
func (self PostgresDatabase) GetEncAddress(addr string) (encaddr string, err error)
func (PostgresDatabase) GetEncKey ¶
func (self PostgresDatabase) GetEncKey(encAddr string) (enckey string, err error)
func (PostgresDatabase) GetGroupForMessage ¶
func (self PostgresDatabase) GetGroupForMessage(message_id string) (group string, err error)
func (PostgresDatabase) GetGroupForPage ¶
func (self PostgresDatabase) GetGroupForPage(prefix, frontend, newsgroup string, pageno, perpage int) BoardModel
only fetches root posts does not update the thread contents
func (PostgresDatabase) GetGroupPageCount ¶
func (self PostgresDatabase) GetGroupPageCount(newsgroup string) int64
func (PostgresDatabase) GetGroupThreads ¶
func (self PostgresDatabase) GetGroupThreads(group string, recv chan ArticleEntry)
func (PostgresDatabase) GetIPAddress ¶
func (self PostgresDatabase) GetIPAddress(encaddr string) (addr string, err error)
func (PostgresDatabase) GetInfoForMessage ¶
func (PostgresDatabase) GetLastAndFirstForGroup ¶
func (self PostgresDatabase) GetLastAndFirstForGroup(group string) (last, first int64, err error)
func (PostgresDatabase) GetLastBumpedThreads ¶
func (self PostgresDatabase) GetLastBumpedThreads(newsgroup string, threads int) (roots []ArticleEntry)
func (PostgresDatabase) GetMessageIDByHash ¶
func (self PostgresDatabase) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
func (PostgresDatabase) GetMessageIDForNNTPID ¶
func (self PostgresDatabase) GetMessageIDForNNTPID(group string, id int64) (msgid string, err error)
func (PostgresDatabase) GetPageForRootMessage ¶
func (self PostgresDatabase) GetPageForRootMessage(root_message_id string) (group string, page int64, err error)
func (PostgresDatabase) GetPagesPerBoard ¶
func (self PostgresDatabase) GetPagesPerBoard(group string) (int, error)
func (PostgresDatabase) GetPostAttachmentModels ¶
func (self PostgresDatabase) GetPostAttachmentModels(prefix, messageID string) (atts []AttachmentModel)
func (PostgresDatabase) GetPostAttachments ¶
func (self PostgresDatabase) GetPostAttachments(messageID string) (atts []string)
func (PostgresDatabase) GetPostModel ¶
func (self PostgresDatabase) GetPostModel(prefix, messageID string) PostModel
func (PostgresDatabase) GetPostsInGroup ¶
func (self PostgresDatabase) GetPostsInGroup(newsgroup string) (models []PostModel, err error)
func (PostgresDatabase) GetRootPostsForExpiration ¶
func (self PostgresDatabase) GetRootPostsForExpiration(newsgroup string, threadcount int) (roots []string)
func (PostgresDatabase) GetThreadReplies ¶
func (self PostgresDatabase) GetThreadReplies(rootpost string, limit int) (repls []string)
func (PostgresDatabase) GetThreadReplyPostModels ¶
func (self PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string, limit int) (repls []PostModel)
func (PostgresDatabase) GetThreadsPerPage ¶
func (self PostgresDatabase) GetThreadsPerPage(group string) (int, error)
func (PostgresDatabase) GroupHasPosts ¶
func (self PostgresDatabase) GroupHasPosts(group string) bool
func (PostgresDatabase) HasArticle ¶
func (self PostgresDatabase) HasArticle(message_id string) bool
check if an article exists
func (PostgresDatabase) HasArticleLocal ¶
func (self PostgresDatabase) HasArticleLocal(message_id string) bool
check if an article exists locally
func (PostgresDatabase) HasNewsgroup ¶
func (self PostgresDatabase) HasNewsgroup(group string) bool
check if a newsgroup exists
func (PostgresDatabase) IsExpired ¶
func (self PostgresDatabase) IsExpired(root_message_id string) bool
func (PostgresDatabase) MarkModPubkeyCanModGroup ¶
func (self PostgresDatabase) MarkModPubkeyCanModGroup(pubkey, group string) (err error)
func (PostgresDatabase) MarkModPubkeyGlobal ¶
func (self PostgresDatabase) MarkModPubkeyGlobal(pubkey string) (err error)
func (PostgresDatabase) NewsgroupBanned ¶
func (self PostgresDatabase) NewsgroupBanned(group string) (banned bool, err error)
func (PostgresDatabase) NukeNewsgroup ¶
func (self PostgresDatabase) NukeNewsgroup(group string, store ArticleStore)
func (PostgresDatabase) RegisterArticle ¶
func (self PostgresDatabase) RegisterArticle(message NNTPMessage)
register a message with the database
func (PostgresDatabase) RegisterNewsgroup ¶
func (self PostgresDatabase) RegisterNewsgroup(group string)
register a new newsgroup
func (PostgresDatabase) RegisterSigned ¶
func (self PostgresDatabase) RegisterSigned(message_id, pubkey string) (err error)
func (PostgresDatabase) ThreadHasReplies ¶
func (self PostgresDatabase) ThreadHasReplies(rootpost string) bool
func (PostgresDatabase) UnMarkModPubkeyCanModGroup ¶
func (self PostgresDatabase) UnMarkModPubkeyCanModGroup(pubkey, group string) (err error)
func (PostgresDatabase) UnMarkModPubkeyGlobal ¶
func (self PostgresDatabase) UnMarkModPubkeyGlobal(pubkey string) (err error)
func (PostgresDatabase) UnbanAddr ¶
func (self PostgresDatabase) UnbanAddr(addr string) (err error)
assumes it is there
func (PostgresDatabase) UnbanNewsgroup ¶
func (self PostgresDatabase) UnbanNewsgroup(group string) (err error)
type SRNdConfig ¶
type SRNdConfig struct {
// contains filtered or unexported fields
}
type ThreadModel ¶
type ThreadModel interface { BaseModel NavbarModel OP() PostModel Replies() []PostModel Board() string BoardURL() string // return a short version of the thread // does not include all replies Truncate() ThreadModel // update the thread's replies // return the updated model Update(db Database) ThreadModel }
for threads