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 interfaces
model_mem.go
models held in memory
nntp.go -- nntp interface for peering
policy.go
postgres db backend
templates.go template model interfaces
tools.go -- srndv2 cli tool functions
Index ¶
- Constants
- Variables
- func CheckConfig()
- func CheckFile(fname string) bool
- func DelFile(fname string)
- func EnsureDir(dirname string)
- func GenFeedsConfig() error
- func GenSRNdConfig() *configparser.Configuration
- func GenTLS(cfg *CryptoConfig) (tcfg *tls.Config, err error)
- func HandleStartTLS(conn net.Conn, config *tls.Config) (econn *textproto.Conn, state tls.ConnectionState, err error)
- func HashMessageID(msgid string) string
- func IPNet2MinMax(inet *net.IPNet) (min, max net.IP)
- func InitI18n(locale, dir string)
- func InstallerEnabled() bool
- func IsDir(dirname string) bool
- func IsSubnet(cidr string) (bool, *net.IPNet)
- func KeygenTool()
- func MessageIDWillDoDubs(msgid string) bool
- func MessageIDWillDoQuads(msgid string) bool
- func MessageIDWillDoTrips(msgid string) bool
- func OpenFileWriter(fname string) (io.WriteCloser, error)
- func RedisEnabled() bool
- func RegenTool()
- func RunModEngine(mod ModEngine, regen RegenFunc)
- func SaveFeeds(feeds []FeedConfig) (err error)
- func SendStartTLS(conn net.Conn, config *tls.Config) (econn *textproto.Conn, state tls.ConnectionState, err error)
- func ShortHashMessageID(msgid string) string
- func ShorterHashMessageID(msgid string) string
- func ThumbnailTool()
- func ValidMessageID(id string) bool
- func Version() string
- func ZeroIPString(ip net.IP) string
- type APIConfig
- type APIModel
- type AdminFunc
- type ArticleEntry
- type ArticleHeaders
- type ArticleStore
- type AttachmentModel
- type BaseDialogModel
- type BaseModel
- type BinaryModel
- type BoardModel
- type CacheInterface
- func NewCache(cache_type, host, port, user, password string, config map[string]string, ...) CacheInterface
- func NewFileCache(prefix, webroot, name string, threads int, attachments bool, db Database, ...) CacheInterface
- func NewNullCache(prefix, webroot, name string, attachments bool, db Database, ...) CacheInterface
- func NewRedisCache(prefix, webroot, name string, threads int, attachments bool, db Database, ...) CacheInterface
- type CatalogItemModel
- type CatalogModel
- type CryptoConfig
- type CryptoModel
- type DBModel
- type Database
- type ErrorModel
- type ExpirationCore
- type FeedConfig
- type FeedPolicy
- type FileCache
- func (self *FileCache) Close()
- func (self *FileCache) DeleteBoardMarkup(group string)
- func (self *FileCache) DeleteThreadMarkup(root_post_id string)
- func (self *FileCache) GetGroupChan() chan groupRegenRequest
- func (self *FileCache) GetHandler() http.Handler
- func (self *FileCache) GetThreadChan() chan ArticleEntry
- func (self *FileCache) Regen(msg ArticleEntry)
- func (self *FileCache) RegenAll()
- func (self *FileCache) RegenFrontPage()
- func (self *FileCache) RegenOnModEvent(newsgroup, msgid, root string, page int)
- func (self *FileCache) RegenerateBoard(group string)
- func (self *FileCache) Start()
- type Frontend
- type FrontendModel
- type GroupModel
- type Installer
- type KeyModel
- type LineWriter
- type LinkModel
- type MessageReader
- type MessageWriter
- type ModEngine
- type ModEvent
- type ModMessage
- type ModUI
- type NNTPAttachment
- type NNTPDaemon
- func (self *NNTPDaemon) AddNNTPLogin(username, password string)
- func (self *NNTPDaemon) CanTLS() (can bool)
- func (self *NNTPDaemon) DelNNTPLogin(username string)
- func (self NNTPDaemon) End()
- func (self *NNTPDaemon) Federate() (federate bool)
- func (self *NNTPDaemon) GetDatabase() Database
- func (self *NNTPDaemon) GetOurTLSConfig() *tls.Config
- func (self *NNTPDaemon) GetTLSConfig(hostname string) *tls.Config
- func (self *NNTPDaemon) RequireTLS() (require bool)
- func (self *NNTPDaemon) Run()
- func (self *NNTPDaemon) Setup()
- func (self *NNTPDaemon) WrapSign(nntp NNTPMessage) NNTPMessage
- type NNTPMessage
- type NameModel
- type NavbarModel
- type NullCache
- func (self *NullCache) Close()
- func (self *NullCache) DeleteBoardMarkup(group string)
- func (self *NullCache) DeleteThreadMarkup(root_post_id string)
- func (self *NullCache) GetGroupChan() chan groupRegenRequest
- func (self *NullCache) GetHandler() http.Handler
- func (self *NullCache) GetThreadChan() chan ArticleEntry
- func (self *NullCache) Regen(msg ArticleEntry)
- func (self *NullCache) RegenAll()
- func (self *NullCache) RegenFrontPage()
- func (self *NullCache) RegenOnModEvent(newsgroup, msgid, root string, page int)
- func (self *NullCache) RegenerateBoard(group string)
- func (self *NullCache) Start()
- type PostEntry
- type PostModel
- type PostgresDatabase
- func (self *PostgresDatabase) AddModPubkey(pubkey string) error
- func (self *PostgresDatabase) AddNNTPLogin(username, passwd string) (err 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) CheckNNTPLogin(username, passwd string) (valid bool, err error)
- func (self *PostgresDatabase) CheckNNTPUserExists(username string) (exists bool, err error)
- func (self *PostgresDatabase) Close()
- func (self *PostgresDatabase) CountAllArticlesInGroup(group string) (count int64, err error)
- 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) GetHeadersForMessage(msgid string) (hdr ArticleHeaders, err error)
- 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) GetLastDaysPosts(n int64) (posts []PostEntry)
- func (self *PostgresDatabase) GetLastDaysPostsForGroup(newsgroup string, n int64) (posts []PostEntry)
- func (self *PostgresDatabase) GetLastPostedPostModels(prefix string, n int64) (posts []PostModel)
- func (self *PostgresDatabase) GetMessageIDByCIDR(cidr *net.IPNet) (msgids []string, err error)
- func (self *PostgresDatabase) GetMessageIDByEncryptedIP(encaddr string) (msgids []string, err error)
- func (self *PostgresDatabase) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
- func (self *PostgresDatabase) GetMessageIDByHeader(name, val string) (msgids []string, err error)
- func (self *PostgresDatabase) GetMessageIDForNNTPID(group string, id int64) (msgid string, err error)
- func (self *PostgresDatabase) GetMonthlyPostHistory() (posts []PostEntry)
- func (self *PostgresDatabase) GetNNTPIDForMessageID(group, msgid string) (id int64, 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, start, limit int) (repls []string)
- func (self *PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string, start, 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) (err error)
- func (self *PostgresDatabase) RegisterNewsgroup(group string)
- func (self *PostgresDatabase) RegisterSigned(message_id, pubkey string) (err error)
- func (self *PostgresDatabase) RemoveNNTPLogin(username 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 ProfilingConfig
- type RedisCache
- func (self *RedisCache) Close()
- func (self *RedisCache) DeleteBoardMarkup(group string)
- func (self *RedisCache) DeleteThreadMarkup(root_post_id string)
- func (self *RedisCache) GetGroupChan() chan groupRegenRequest
- func (self *RedisCache) GetHandler() http.Handler
- func (self *RedisCache) GetThreadChan() chan ArticleEntry
- func (self *RedisCache) Regen(msg ArticleEntry)
- func (self *RedisCache) RegenAll()
- func (self *RedisCache) RegenFrontPage()
- func (self *RedisCache) RegenOnModEvent(newsgroup, msgid, root string, page int)
- func (self *RedisCache) RegenerateBoard(group string)
- func (self *RedisCache) Start()
- type RedisDB
- func (self RedisDB) AddModPubkey(pubkey string) error
- func (self RedisDB) AddNNTPLogin(username, passwd string) (err error)
- func (self RedisDB) ArticleBanned(messageID string) (result bool)
- func (self RedisDB) ArticleCount() (count int64)
- func (self RedisDB) BanAddr(addr string) (err error)
- func (self RedisDB) BanArticle(messageID, reason string) error
- func (self RedisDB) BanEncAddr(encaddr string) (err error)
- func (self RedisDB) BanNewsgroup(group string) (err error)
- func (self RedisDB) CheckEncIPBanned(encaddr string) (banned bool, err error)
- func (self RedisDB) CheckIPBanned(addr string) (banned bool, err error)
- func (self RedisDB) CheckModPubkey(pubkey string) bool
- func (self RedisDB) CheckModPubkeyCanModGroup(pubkey, newsgroup string) bool
- func (self RedisDB) CheckModPubkeyGlobal(pubkey string) bool
- func (self RedisDB) CheckNNTPLogin(username, passwd string) (valid bool, err error)
- func (self RedisDB) CheckNNTPUserExists(username string) (exists bool, err error)
- func (self RedisDB) Close()
- func (self RedisDB) CountAllArticlesInGroup(group string) (count int64, err error)
- func (self RedisDB) CountPostsInGroup(newsgroup string, time_frame int64) (result int64)
- func (self RedisDB) CountThreadReplies(root_message_id string) (repls int64)
- func (self RedisDB) CreateTables()
- func (self RedisDB) DeleteArticle(msgid string) (err error)
- func (self RedisDB) DeleteThread(msgid string) (err error)
- func (self RedisDB) GetAllArticles() (articles []ArticleEntry)
- func (self RedisDB) GetAllArticlesInGroup(group string, recv chan ArticleEntry)
- func (self RedisDB) GetAllNewsgroups() (groups []string)
- func (self RedisDB) GetEncAddress(addr string) (encaddr string, err error)
- func (self RedisDB) GetEncKey(encAddr string) (enckey string, err error)
- func (self RedisDB) GetGroupForMessage(message_id string) (group string, err error)
- func (self RedisDB) GetGroupForPage(prefix, frontend, newsgroup string, pageno, perpage int) BoardModel
- func (self RedisDB) GetGroupPageCount(newsgroup string) int64
- func (self RedisDB) GetGroupThreads(group string, recv chan ArticleEntry)
- func (self RedisDB) GetHeadersForMessage(msgid string) (hdr ArticleHeaders, err error)
- func (self RedisDB) GetIPAddress(encaddr string) (addr string, err error)
- func (self RedisDB) GetInfoForMessage(msgid string) (root string, newsgroup string, page int64, err error)
- func (self RedisDB) GetLastAndFirstForGroup(group string) (last, first int64, err error)
- func (self RedisDB) GetLastBumpedThreads(newsgroup string, threads int) (roots []ArticleEntry)
- func (self RedisDB) GetLastDaysPosts(n int64) (posts []PostEntry)
- func (self RedisDB) GetLastDaysPostsForGroup(newsgroup string, n int64) (posts []PostEntry)
- func (self RedisDB) GetLastPostedPostModels(prefix string, n int64) (posts []PostModel)
- func (self RedisDB) GetMessageIDByCIDR(cidr *net.IPNet) (msgids []string, err error)
- func (self RedisDB) GetMessageIDByEncryptedIP(encip string) (msgids []string, err error)
- func (self RedisDB) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
- func (self RedisDB) GetMessageIDByHeader(name, val string) (msgids []string, err error)
- func (self RedisDB) GetMessageIDForNNTPID(group string, id int64) (msgid string, err error)
- func (self RedisDB) GetMonthlyPostHistory() (posts []PostEntry)
- func (self RedisDB) GetNNTPIDForMessageID(group, msgid string) (id int64, err error)
- func (self RedisDB) GetPageForRootMessage(root_message_id string) (group string, page int64, err error)
- func (self RedisDB) GetPagesPerBoard(group string) (int, error)
- func (self RedisDB) GetPostAttachmentModels(prefix, messageID string) (atts []AttachmentModel)
- func (self RedisDB) GetPostAttachments(messageID string) (atts []string)
- func (self RedisDB) GetPostModel(prefix, messageID string) PostModel
- func (self RedisDB) GetPostsInGroup(newsgroup string) (models []PostModel, err error)
- func (self RedisDB) GetRootPostsForExpiration(newsgroup string, threadcount int) (roots []string)
- func (self RedisDB) GetThreadReplies(rootpost string, start, limit int) (repls []string)
- func (self RedisDB) GetThreadReplyPostModels(prefix, rootpost string, start, limit int) (repls []PostModel)
- func (self RedisDB) GetThreadsPerPage(group string) (int, error)
- func (self RedisDB) GroupHasPosts(group string) bool
- func (self RedisDB) HasArticle(message_id string) bool
- func (self RedisDB) HasArticleLocal(message_id string) bool
- func (self RedisDB) HasNewsgroup(group string) bool
- func (self RedisDB) IsExpired(root_message_id string) bool
- func (self RedisDB) MarkModPubkeyCanModGroup(pubkey, group string) (err error)
- func (self RedisDB) MarkModPubkeyGlobal(pubkey string) (err error)
- func (self RedisDB) NewsgroupBanned(group string) (banned bool, err error)
- func (self RedisDB) NukeNewsgroup(group string, store ArticleStore)
- func (self RedisDB) RegisterArticle(message NNTPMessage) (err error)
- func (self RedisDB) RegisterNewsgroup(group string)
- func (self RedisDB) RegisterSigned(message_id, pubkey string) (err error)
- func (self RedisDB) RemoveNNTPLogin(username string) (err error)
- func (self RedisDB) ThreadHasReplies(rootpost string) bool
- func (self RedisDB) UnMarkModPubkeyCanModGroup(pubkey, group string) (err error)
- func (self RedisDB) UnMarkModPubkeyGlobal(pubkey string) (err error)
- func (self RedisDB) UnbanAddr(addr string) (err error)
- func (self RedisDB) UnbanNewsgroup(group string) (err error)
- type RegenFunc
- type SRNdConfig
- type StepModel
- type ThreadModel
Constants ¶
const ( ARTICLE_PREFIX = APP_PREFIX + "Article::" ARTICLE_POST_PREFIX = APP_PREFIX + "ArticlePost::" ARTICLE_KEY_PREFIX = APP_PREFIX + "ArticleKey::" ARTICLE_NUMBERS_PREFIX = APP_PREFIX + "ArticleNumbers::" HASH_MESSAGEID_PREFIX = APP_PREFIX + "HashMessageID::" ATTACHMENT_PREFIX = APP_PREFIX + "Attachment::" BANNED_GROUP_PREFIX = APP_PREFIX + "BannedGroup::" BANNED_ARTICLE_PREFIX = APP_PREFIX + "BannedArticle::" MOD_KEY_PREFIX = APP_PREFIX + "ModKey::" NNTP_LOGIN_PREFIX = APP_PREFIX + "Login::" ENCRYPTED_ADDRS_PREFIX = APP_PREFIX + "EncryptedAddrs::" ADDRS_ENCRYPTED_ADDRS_PREFIX = APP_PREFIX + "AddrsEncryptedAddrs::" ENCRYPTED_IP_BAN_PREFIX = APP_PREFIX + "EncIPBan::" IP_BAN_PREFIX = APP_PREFIX + "IPBan::" IP_RANGE_BAN_PREFIX = APP_PREFIX + "IPRangeBan::" )
const ( GROUP_POSTTIME_WKR = APP_PREFIX + "GroupPostTimeWKR" GROUP_ARTICLE_POSTTIME_WKR_PREFIX = APP_PREFIX + "GroupArticlePostTimeWKR::" GROUP_THREAD_POSTTIME_WKR_PREFIX = APP_PREFIX + "GroupThreadPostTimeWKR::" GROUP_THREAD_BUMPTIME_WKR_PREFIX = APP_PREFIX + "GroupThreadBumpTimeWKR::" GROUP_MOD_KEY_REVERSE_KR_PREFIX = APP_PREFIX + "GroupModKeysKR::" THREAD_POST_WKR = APP_PREFIX + "ThreadPostsWKR::" ARTICLE_WKR = APP_PREFIX + "ArticleWKR" THREAD_BUMPTIME_WKR = APP_PREFIX + "ThreadBumpTimeWKR" HEADER_KR_PREFIX = APP_PREFIX + "HeaderKR::" MESSAGEID_HEADER_KR_PREFIX = APP_PREFIX + "MessageIDHeaderKR::" ARTICLE_ATTACHMENT_KR_PREFIX = APP_PREFIX + "ArticleAttachmentsKR::" ATTACHMENT_ARTICLE_KR_PREFIX = APP_PREFIX + "AttachmentArticlesKR::" IP_RANGE_BAN_KR = APP_PREFIX + "IPRangeBanKR" )
const ( HISTORY = CACHE_PREFIX + "History" INDEX = CACHE_PREFIX + "Index" BOARDS = CACHE_PREFIX + "Boards" UKKO = CACHE_PREFIX + "Ukko" JSON_UKKO = "JSON::" + UKKO THREAD_PREFIX = CACHE_PREFIX + "Thread::" JSON_THREAD_PREFIX = "JSON::" + THREAD_PREFIX GROUP_PREFIX = CACHE_PREFIX + "Group::" JSON_GROUP_PREFIX = "JSON::" + GROUP_PREFIX CATALOG_PREFIX = CACHE_PREFIX + "Catalog::" )
const APP_PREFIX = "NNTP::"
const CACHE_PREFIX = "NNTPCache::"
const MIN_REDIS_VERSION = "3.0"
Variables ¶
var Discard = new(discardCloser)
like ioutil.Discard but an io.WriteCloser
var TlsFailedToLoadCA = errors.New("could not load CA files")
var TlsNotSupported = errors.New("TLS not supported")
Functions ¶
func GenTLS ¶
func GenTLS(cfg *CryptoConfig) (tcfg *tls.Config, err error)
generate tls config, private key and certificate
func HandleStartTLS ¶
func HandleStartTLS(conn net.Conn, config *tls.Config) (econn *textproto.Conn, state tls.ConnectionState, err error)
handle STARTTLS on connection
func InitI18n ¶
func InitI18n(locale, dir string)
Read all .ini files in dir, where the filenames are BCP 47 tags Use the language matcher to get the best match for the locale preference
func InstallerEnabled ¶
func InstallerEnabled() bool
func MessageIDWillDoDubs ¶
will this message id produce dubs?
func MessageIDWillDoQuads ¶
will this message id produce quads?
func MessageIDWillDoTrips ¶
will this message id produce trips?
func OpenFileWriter ¶
func OpenFileWriter(fname string) (io.WriteCloser, error)
func RedisEnabled ¶
func RedisEnabled() bool
func RunModEngine ¶
run a mod engine logic mainloop
func SaveFeeds ¶
func SaveFeeds(feeds []FeedConfig) (err error)
save a list of feeds to overwrite feeds.ini
func SendStartTLS ¶
func ValidMessageID ¶
func ZeroIPString ¶
Types ¶
type APIModel ¶
type APIModel struct { ErrorModel StepModel // contains filtered or unexported fields }
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) Add ¶
func (self ArticleHeaders) Add(key, val string)
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 // full filepath to attachment directory AttachmentDir() string // 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 // get the filename of a message GetFilename(msgid string) string // Get a message given its messageid GetMessage(msgid string) NNTPMessage // open a message in the store for reading given its message-id // return io.ReadCloser, error OpenMessage(msgid string) (io.ReadCloser, 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 // generate all thumbanils for this message ThumbnailMessage(msgid string) // did we enable compression? Compression() bool // process body of nntp message, register attachments and the article // write the body into writer as we go through the body // does NOT write mime header ProcessMessageBody(wr io.Writer, hdr textproto.MIMEHeader, body io.Reader) error // register this post with the daemon RegisterPost(nntp NNTPMessage) error // register signed message RegisterSigned(msgid, pk string) error }
type AttachmentModel ¶
for attachments
type BaseDialogModel ¶
type BaseDialogModel struct { ErrorModel StepModel }
type BaseModel ¶
type BaseModel interface { // site url prefix Prefix() string // impelements json.Marshaller MarshalJSON() ([]byte, error) }
base model type
type BinaryModel ¶
type BinaryModel struct { ErrorModel StepModel // contains filtered or unexported fields }
func (*BinaryModel) Convert ¶
func (self *BinaryModel) Convert() string
func (*BinaryModel) FFmpeg ¶
func (self *BinaryModel) FFmpeg() string
func (*BinaryModel) Sox ¶
func (self *BinaryModel) Sox() string
type BoardModel ¶
type BoardModel interface { BaseModel NavbarModel Frontend() string Name() string Threads() []ThreadModel AllowFiles() bool SetAllowFiles(files bool) // JUST update this thread // if we don't have it already loaded do nothing UpdateThread(message_id string, db Database) // get a thread model with this id // returns nil if we don't have it GetThread(message_id string) ThreadModel // put a thread back after updating externally PutThread(th ThreadModel) // deprecated, use GetThread HasThread(message_id string) bool // update the board's contents Update(db Database) }
board interface for 1 page on a board
type CacheInterface ¶
type CacheInterface interface { RegenAll() RegenFrontPage() RegenOnModEvent(string, string, string, int) RegenerateBoard(group string) Regen(msg ArticleEntry) DeleteThreadMarkup(root_post_id string) DeleteBoardMarkup(group string) Start() Close() GetThreadChan() chan ArticleEntry GetGroupChan() chan groupRegenRequest GetHandler() http.Handler }
func NewCache ¶
func NewCache(cache_type, host, port, user, password string, config map[string]string, db Database, store ArticleStore) CacheInterface
TODO only pass needed config
func NewFileCache ¶
func NewFileCache(prefix, webroot, name string, threads int, attachments bool, db Database, store ArticleStore) CacheInterface
func NewNullCache ¶
func NewNullCache(prefix, webroot, name string, attachments bool, db Database, store ArticleStore) CacheInterface
func NewRedisCache ¶
type CatalogItemModel ¶
type CatalogModel ¶
type CatalogModel interface { BaseModel NavbarModel Frontend() string Name() string Threads() []CatalogItemModel }
type CryptoConfig ¶
type CryptoConfig struct {
// contains filtered or unexported fields
}
type CryptoModel ¶
type CryptoModel struct { ErrorModel StepModel // contains filtered or unexported fields }
func (*CryptoModel) Host ¶
func (self *CryptoModel) Host() string
func (*CryptoModel) Key ¶
func (self *CryptoModel) Key() string
type DBModel ¶
type DBModel struct { ErrorModel StepModel // contains filtered or unexported fields }
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) error GetAllArticlesInGroup(group string, send chan ArticleEntry) CountAllArticlesInGroup(group string) (int64, error) 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 // start at reply number start GetThreadReplies(root_message_id string, start, 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 // does not load replies for thread, only gets root posts 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, start, 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) // get nntp id for a given message-id GetNNTPIDForMessageID(group, msgid string) (int64, error) // get the last N days post count in decending order GetLastDaysPosts(n int64) []PostEntry // get the last N days post count in decending order GetLastDaysPostsForGroup(newsgroup string, n int64) []PostEntry // get post history per month since beginning of time GetMonthlyPostHistory() []PostEntry // get the last N posts that were made globally GetLastPostedPostModels(prefix string, n int64) []PostModel // check if an nntp login cred is correct CheckNNTPLogin(username, passwd string) (bool, error) // add an nntp login credential AddNNTPLogin(username, passwd string) error // remove an nntp login credential RemoveNNTPLogin(username string) error // check if an nntp login credential given a user exists CheckNNTPUserExists(username string) (bool, error) // get the message ids of an article that has this header with the given value GetMessageIDByHeader(name, value string) ([]string, error) // get the headers for a message given its message-id GetHeadersForMessage(msgid string) (ArticleHeaders, error) // get all message-ids posted by posters in this cidr GetMessageIDByCIDR(cidr *net.IPNet) ([]string, error) // get all message-ids posted by poster with encrypted ip GetMessageIDByEncryptedIP(encaddr string) ([]string, error) }
func NewDatabase ¶
func NewPostgresDatabase ¶
func NewRedisDatabase ¶
type ErrorModel ¶
type ErrorModel struct {
Err error
}
func (*ErrorModel) Error ¶
func (self *ErrorModel) Error() string
func (*ErrorModel) HasError ¶
func (self *ErrorModel) HasError() bool
type ExpirationCore ¶
type ExpirationCore interface { // do expiration for a group ExpireGroup(newsgroup string, keep int) // Delete a single post and all children ExpirePost(messageID string) // expire all orphaned articles ExpireOrphans() // run our mainloop Mainloop() }
content expiration interface
type FeedConfig ¶
type FeedPolicy ¶
type FeedPolicy struct {
// contains filtered or unexported fields
}
func (*FeedPolicy) AllowsNewsgroup ¶
func (self *FeedPolicy) AllowsNewsgroup(newsgroup string) (result bool)
do we allow this newsgroup?
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func (*FileCache) DeleteBoardMarkup ¶
func (*FileCache) DeleteThreadMarkup ¶
try to delete root post's page
func (*FileCache) GetGroupChan ¶
func (self *FileCache) GetGroupChan() chan groupRegenRequest
func (*FileCache) GetHandler ¶
func (*FileCache) GetThreadChan ¶
func (self *FileCache) GetThreadChan() chan ArticleEntry
func (*FileCache) Regen ¶
func (self *FileCache) Regen(msg ArticleEntry)
func (*FileCache) RegenFrontPage ¶
func (self *FileCache) RegenFrontPage()
regenerate the front page
func (*FileCache) RegenOnModEvent ¶
regenerate pages after a mod event
func (*FileCache) RegenerateBoard ¶
regen every page of the board
type Frontend ¶
type Frontend interface { // channel that is for the frontend to pool for new posts from the nntpd PostsChan() chan frontendPost // 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, cache CacheInterface, config map[string]string, url string) Frontend
create a new http based frontend
type FrontendModel ¶
type FrontendModel struct { ErrorModel StepModel // contains filtered or unexported fields }
func (*FrontendModel) Locale ¶
func (self *FrontendModel) Locale() string
func (*FrontendModel) Name ¶
func (self *FrontendModel) Name() string
type GroupModel ¶
type GroupModel []BoardModel
newsgroup model every page on a newsgroup
func (*GroupModel) Update ¶
func (self *GroupModel) Update(page int, db Database)
update a certain page does nothing if out of bounds
func (*GroupModel) UpdateAll ¶
func (self *GroupModel) UpdateAll(db Database)
TODO: optimize using 1 query? update every page
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
func NewInstaller ¶
func NewInstaller(result chan *configparser.Configuration) *Installer
func (*Installer) HandleInstallerGet ¶
func (self *Installer) HandleInstallerGet(wr http.ResponseWriter, r *http.Request)
func (*Installer) HandleInstallerPost ¶
func (self *Installer) HandleInstallerPost(wr http.ResponseWriter, r *http.Request)
type KeyModel ¶
type KeyModel struct { ErrorModel StepModel // contains filtered or unexported fields }
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
func NewLineWriter ¶
func NewLineWriter(w io.Writer) *LineWriter
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 given message_id MessageChan() chan string // 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 // load a mod message LoadMessage(msgid string) NNTPMessage }
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 { io.WriterTo io.Writer // 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 // 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 // base64'd file data Filedata() string // as raw string AsString() string // reset contents Reset() // get bytes Bytes() []byte // save to directory, filename is decided by the attachment Save(dir string) error }
type NNTPDaemon ¶
type NNTPDaemon struct {
// contains filtered or unexported fields
}
func (*NNTPDaemon) AddNNTPLogin ¶
func (self *NNTPDaemon) AddNNTPLogin(username, password string)
for srnd tool
func (*NNTPDaemon) CanTLS ¶
func (self *NNTPDaemon) CanTLS() (can bool)
return true if we can do tls
func (*NNTPDaemon) DelNNTPLogin ¶
func (self *NNTPDaemon) DelNNTPLogin(username string)
for srnd tool
func (NNTPDaemon) End ¶
func (self NNTPDaemon) End()
func (*NNTPDaemon) Federate ¶
func (self *NNTPDaemon) Federate() (federate bool)
func (*NNTPDaemon) GetDatabase ¶
func (self *NNTPDaemon) GetDatabase() Database
func (*NNTPDaemon) GetOurTLSConfig ¶
func (self *NNTPDaemon) GetOurTLSConfig() *tls.Config
func (*NNTPDaemon) GetTLSConfig ¶
func (self *NNTPDaemon) GetTLSConfig(hostname string) *tls.Config
func (*NNTPDaemon) RequireTLS ¶
func (self *NNTPDaemon) RequireTLS() (require bool)
func (*NNTPDaemon) Setup ¶
func (self *NNTPDaemon) Setup()
func (*NNTPDaemon) WrapSign ¶
func (self *NNTPDaemon) WrapSign(nntp NNTPMessage) NNTPMessage
sign an article as coming from our daemon
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 // get signed part SignedPart() NNTPAttachment // 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) error // write out body WriteBody(wr io.Writer) error // attach a file Attach(att NNTPAttachment) // get the plaintext message if it exists Message() string // pack the whole message and prepare for write Pack() // 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 // reset contents Reset() // get inner signed message Signed() NNTPMessage }
type NameModel ¶
type NameModel struct { ErrorModel StepModel // contains filtered or unexported fields }
type NullCache ¶
type NullCache struct {
// contains filtered or unexported fields
}
func (*NullCache) DeleteBoardMarkup ¶
func (*NullCache) DeleteThreadMarkup ¶
try to delete root post's page
func (*NullCache) GetGroupChan ¶
func (self *NullCache) GetGroupChan() chan groupRegenRequest
func (*NullCache) GetHandler ¶
func (*NullCache) GetThreadChan ¶
func (self *NullCache) GetThreadChan() chan ArticleEntry
func (*NullCache) Regen ¶
func (self *NullCache) Regen(msg ArticleEntry)
func (*NullCache) RegenFrontPage ¶
func (self *NullCache) RegenFrontPage()
func (*NullCache) RegenOnModEvent ¶
regenerate pages after a mod event
func (*NullCache) RegenerateBoard ¶
regen every page of the board
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 ReferenceHash() string RenderBody() string RenderPost() string IsI2P() bool IsTor() bool IsClearnet() bool // truncate body to a certain size // return copy Truncate() PostModel // what is our position in this thread? // 0 for OP, nonzero for reply Index() int // set post index SetIndex(idx int) }
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) AddNNTPLogin ¶
func (self *PostgresDatabase) AddNNTPLogin(username, passwd string) (err 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) CheckNNTPLogin ¶
func (self *PostgresDatabase) CheckNNTPLogin(username, passwd string) (valid bool, err error)
func (*PostgresDatabase) CheckNNTPUserExists ¶
func (self *PostgresDatabase) CheckNNTPUserExists(username string) (exists bool, err error)
func (*PostgresDatabase) Close ¶
func (self *PostgresDatabase) Close()
finalize all transactions close database connections
func (*PostgresDatabase) CountAllArticlesInGroup ¶
func (self *PostgresDatabase) CountAllArticlesInGroup(group string) (count int64, err error)
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) GetHeadersForMessage ¶
func (self *PostgresDatabase) GetHeadersForMessage(msgid string) (hdr ArticleHeaders, err error)
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) GetLastDaysPosts ¶
func (self *PostgresDatabase) GetLastDaysPosts(n int64) (posts []PostEntry)
func (*PostgresDatabase) GetLastDaysPostsForGroup ¶
func (self *PostgresDatabase) GetLastDaysPostsForGroup(newsgroup string, n int64) (posts []PostEntry)
func (*PostgresDatabase) GetLastPostedPostModels ¶
func (self *PostgresDatabase) GetLastPostedPostModels(prefix string, n int64) (posts []PostModel)
func (*PostgresDatabase) GetMessageIDByCIDR ¶
func (self *PostgresDatabase) GetMessageIDByCIDR(cidr *net.IPNet) (msgids []string, err error)
func (*PostgresDatabase) GetMessageIDByEncryptedIP ¶
func (self *PostgresDatabase) GetMessageIDByEncryptedIP(encaddr string) (msgids []string, err error)
func (*PostgresDatabase) GetMessageIDByHash ¶
func (self *PostgresDatabase) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
func (*PostgresDatabase) GetMessageIDByHeader ¶
func (self *PostgresDatabase) GetMessageIDByHeader(name, val string) (msgids []string, err error)
get message ids of articles with this header name and value
func (*PostgresDatabase) GetMessageIDForNNTPID ¶
func (self *PostgresDatabase) GetMessageIDForNNTPID(group string, id int64) (msgid string, err error)
func (*PostgresDatabase) GetMonthlyPostHistory ¶
func (self *PostgresDatabase) GetMonthlyPostHistory() (posts []PostEntry)
func (*PostgresDatabase) GetNNTPIDForMessageID ¶
func (self *PostgresDatabase) GetNNTPIDForMessageID(group, msgid string) (id int64, 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, start, limit int) (repls []string)
func (*PostgresDatabase) GetThreadReplyPostModels ¶
func (self *PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string, start, 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) (err error)
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) RemoveNNTPLogin ¶
func (self *PostgresDatabase) RemoveNNTPLogin(username 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 ProfilingConfig ¶
type ProfilingConfig struct {
// contains filtered or unexported fields
}
pprof settings
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func (*RedisCache) Close ¶
func (self *RedisCache) Close()
func (*RedisCache) DeleteBoardMarkup ¶
func (self *RedisCache) DeleteBoardMarkup(group string)
func (*RedisCache) DeleteThreadMarkup ¶
func (self *RedisCache) DeleteThreadMarkup(root_post_id string)
try to delete root post's page
func (*RedisCache) GetGroupChan ¶
func (self *RedisCache) GetGroupChan() chan groupRegenRequest
func (*RedisCache) GetHandler ¶
func (self *RedisCache) GetHandler() http.Handler
func (*RedisCache) GetThreadChan ¶
func (self *RedisCache) GetThreadChan() chan ArticleEntry
func (*RedisCache) Regen ¶
func (self *RedisCache) Regen(msg ArticleEntry)
func (*RedisCache) RegenFrontPage ¶
func (self *RedisCache) RegenFrontPage()
func (*RedisCache) RegenOnModEvent ¶
func (self *RedisCache) RegenOnModEvent(newsgroup, msgid, root string, page int)
regenerate pages after a mod event
func (*RedisCache) RegenerateBoard ¶
func (self *RedisCache) RegenerateBoard(group string)
regen every page of the board TODO do this manually so we can use pipes
func (*RedisCache) Start ¶
func (self *RedisCache) Start()
type RedisDB ¶
type RedisDB struct {
// contains filtered or unexported fields
}
func (RedisDB) AddModPubkey ¶
func (RedisDB) AddNNTPLogin ¶
func (RedisDB) ArticleBanned ¶
func (RedisDB) ArticleCount ¶
count articles we have
func (RedisDB) BanArticle ¶
func (RedisDB) BanEncAddr ¶
func (RedisDB) BanNewsgroup ¶
func (RedisDB) CheckEncIPBanned ¶
func (RedisDB) CheckIPBanned ¶
func (RedisDB) CheckModPubkey ¶
func (RedisDB) CheckModPubkeyCanModGroup ¶
func (RedisDB) CheckModPubkeyGlobal ¶
func (RedisDB) CheckNNTPLogin ¶
func (RedisDB) CheckNNTPUserExists ¶
func (RedisDB) Close ¶
func (self RedisDB) Close()
finalize all transactions close database connections
func (RedisDB) CountAllArticlesInGroup ¶
func (RedisDB) CountPostsInGroup ¶
func (RedisDB) CountThreadReplies ¶
func (RedisDB) CreateTables ¶
func (self RedisDB) CreateTables()
func (RedisDB) DeleteArticle ¶
func (RedisDB) DeleteThread ¶
func (RedisDB) GetAllArticles ¶
func (self RedisDB) GetAllArticles() (articles []ArticleEntry)
get all articles
func (RedisDB) GetAllArticlesInGroup ¶
func (self RedisDB) GetAllArticlesInGroup(group string, recv chan ArticleEntry)
get all articles in a newsgroup send result down a channel
func (RedisDB) GetAllNewsgroups ¶
func (RedisDB) GetEncAddress ¶
func (RedisDB) GetGroupForMessage ¶
func (RedisDB) GetGroupForPage ¶
func (self RedisDB) GetGroupForPage(prefix, frontend, newsgroup string, pageno, perpage int) BoardModel
only fetches root posts does not update the thread contents
func (RedisDB) GetGroupPageCount ¶
func (RedisDB) GetGroupThreads ¶
func (self RedisDB) GetGroupThreads(group string, recv chan ArticleEntry)
func (RedisDB) GetHeadersForMessage ¶
func (self RedisDB) GetHeadersForMessage(msgid string) (hdr ArticleHeaders, err error)
func (RedisDB) GetIPAddress ¶
func (RedisDB) GetInfoForMessage ¶
func (RedisDB) GetLastAndFirstForGroup ¶
func (RedisDB) GetLastBumpedThreads ¶
func (self RedisDB) GetLastBumpedThreads(newsgroup string, threads int) (roots []ArticleEntry)
func (RedisDB) GetLastDaysPosts ¶
func (RedisDB) GetLastDaysPostsForGroup ¶
func (RedisDB) GetLastPostedPostModels ¶
func (RedisDB) GetMessageIDByCIDR ¶
func (RedisDB) GetMessageIDByEncryptedIP ¶
func (RedisDB) GetMessageIDByHash ¶
func (self RedisDB) GetMessageIDByHash(hash string) (article ArticleEntry, err error)
func (RedisDB) GetMessageIDByHeader ¶
get message ids of articles with this header name and value
func (RedisDB) GetMessageIDForNNTPID ¶
func (RedisDB) GetMonthlyPostHistory ¶
func (RedisDB) GetNNTPIDForMessageID ¶
func (RedisDB) GetPageForRootMessage ¶
func (RedisDB) GetPostAttachmentModels ¶
func (self RedisDB) GetPostAttachmentModels(prefix, messageID string) (atts []AttachmentModel)
func (RedisDB) GetPostAttachments ¶
func (RedisDB) GetPostModel ¶
func (RedisDB) GetPostsInGroup ¶
func (RedisDB) GetRootPostsForExpiration ¶
func (RedisDB) GetThreadReplies ¶
func (RedisDB) GetThreadReplyPostModels ¶
func (RedisDB) GroupHasPosts ¶
func (RedisDB) HasArticle ¶
check if an article exists
func (RedisDB) HasArticleLocal ¶
check if an article exists locally
func (RedisDB) HasNewsgroup ¶
check if a newsgroup exists
func (RedisDB) MarkModPubkeyCanModGroup ¶
func (RedisDB) MarkModPubkeyGlobal ¶
func (RedisDB) NewsgroupBanned ¶
func (RedisDB) NukeNewsgroup ¶
func (self RedisDB) NukeNewsgroup(group string, store ArticleStore)
func (RedisDB) RegisterArticle ¶
func (self RedisDB) RegisterArticle(message NNTPMessage) (err error)
register a message with the database
func (RedisDB) RegisterNewsgroup ¶
register a new newsgroup
func (RedisDB) RegisterSigned ¶
func (RedisDB) RemoveNNTPLogin ¶
func (RedisDB) ThreadHasReplies ¶
func (RedisDB) UnMarkModPubkeyCanModGroup ¶
func (RedisDB) UnMarkModPubkeyGlobal ¶
func (RedisDB) UnbanNewsgroup ¶
type SRNdConfig ¶
type SRNdConfig struct {
// contains filtered or unexported fields
}
type ThreadModel ¶
type ThreadModel interface { BaseModel NavbarModel SetAllowFiles(allow bool) AllowFiles() bool 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 Update(db Database) // is this thread dirty and needing updating? IsDirty() bool // mark thread as dirty MarkDirty() }
for threads
Source Files ¶
- attachment.go
- cache_interface.go
- config.go
- daemon.go
- database.go
- expiration.go
- file_cache.go
- frontend.go
- frontend_http.go
- frontend_multi.go
- i18n.go
- installer.go
- installer_models.go
- line.go
- markup.go
- message.go
- mod.go
- mod_http.go
- model.go
- model_mem.go
- nntp.go
- null_cache.go
- policy.go
- postgres.go
- redis.go
- redis_cache.go
- store.go
- templates.go
- tls.go
- tools.go
- util.go
- version.go