Documentation ¶
Overview ¶
package for parsing config files
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultArticlePolicy = ArticleConfig{ AllowGroups: []string{"ctl", "overchan.test"}, DisallowGroups: []string{"overchan.cp"}, ForceWhitelist: false, AllowAnon: true, AllowAttachments: true, AllowAnonAttachments: false, }
View Source
var DefaultConfig = Config{ Store: &DefaultStoreConfig, NNTP: &DefaultNNTPConfig, Database: &DefaultDatabaseConfig, WebHooks: []*WebhookConfig{DefaultWebHookConfig}, NNTPHooks: []*NNTPHookConfig{DefaultNNTPHookConfig}, Feeds: DefaultFeeds, Frontends: []*FrontendConfig{&DefaultFrontendConfig}, Log: "debug", }
default configuration
View Source
var DefaultDatabaseConfig = DatabaseConfig{
Type: "postgres",
Addr: "/var/run/postgresql",
Password: "",
}
View Source
var DefaultFeeds = []*FeedConfig{ &DuummyFeed, }
View Source
var DefaultFrontendConfig = FrontendConfig{ BindAddr: "127.0.0.1:18888", Static: "./files/static/", Middleware: &DefaultMiddlewareConfig, }
default Frontend Configuration
View Source
var DefaultMiddlewareConfig = MiddlewareConfig{
Type: "overchan",
Templates: "./files/templates/overchan/",
}
View Source
var DefaultNNTPConfig = NNTPServerConfig{ AnonNNTP: false, Bind: "0.0.0.0:1119", Name: "nntp.server.tld", Article: &DefaultArticlePolicy, LoginsFile: "", }
View Source
var DefaultNNTPHookConfig = &NNTPHookConfig{
Name: "dummy",
Exec: "/bin/true",
}
default dummy hook
View Source
var DefaultStoreConfig = StoreConfig{
Path: "storage",
}
View Source
var DefaultTorProxy = ProxyConfig{
Type: "socks",
Addr: "127.0.0.1:9050",
}
default tor proxy
View Source
var DefaultWebHookConfig = &WebhookConfig{
Name: "vichan",
Dialect: "vichan",
URL: "http://localhost/webhook.php",
}
View Source
var DuummyFeed = FeedConfig{ Policy: &DefaultArticlePolicy, Addr: "nntp.dummy.tld:1119", Proxy: &DefaultTorProxy, Name: "dummy", }
Functions ¶
This section is empty.
Types ¶
type ArticleConfig ¶
type ArticleConfig struct { // explicitly allow these newsgroups (regexp) AllowGroups []string `json:"whitelist"` // explicitly disallow these newsgroups (regexp) DisallowGroups []string `json:"blacklist"` // only allow explicitly allowed groups ForceWhitelist bool `json:"force-whitelist"` // allow anonymous posts? AllowAnon bool `json:"anon"` // allow attachments? AllowAttachments bool `json:"attachments"` // allow anonymous attachments? AllowAnonAttachments bool `json:"anon-attachments"` }
configration for local article policies
func (*ArticleConfig) Allow ¶
func (c *ArticleConfig) Allow(msgid, group string, anon, attachment bool) bool
allow an article?
func (*ArticleConfig) AllowGroup ¶
func (c *ArticleConfig) AllowGroup(group string) bool
type CacheConfig ¶
type CacheConfig struct { // backend cache driver name Backend string `json:"backend"` // address for cache Addr string `json:"addr"` // username for login User string `json:"user"` // password for login Password string `json:"password"` }
caching interface configuration
type Config ¶
type Config struct { // nntp server configuration NNTP *NNTPServerConfig `json:"nntp"` // log level Log string `json:"log"` // article storage config Store *StoreConfig `json:"storage"` // web hooks to call WebHooks []*WebhookConfig `json:"webhooks"` // external scripts to call NNTPHooks []*NNTPHookConfig `json:"nntphooks"` // database backend configuration Database *DatabaseConfig `json:"db"` // list of feeds to add on runtime Feeds []*FeedConfig `json:"feeds"` // frontend config Frontends []*FrontendConfig `json:"frontends"` // contains filtered or unexported fields }
main configuration
type DatabaseConfig ¶
type FeedConfig ¶
type FeedConfig struct { // feed's policy, filters articles Policy *ArticleConfig `json:"policy"` // remote server's address Addr string `json:"addr"` // proxy server config Proxy *ProxyConfig `json:"proxy"` // nntp username to log in with Username string `json:"username"` // nntp password to use when logging in Password string `json:"password"` // do we want to use tls? TLS bool `json:"tls"` // the name of this feed Name string `json:"name"` // how often to pull articles from the server in minutes // 0 for never PullInterval int `json:"pull"` }
configuration for 1 nntp feed
type FrontendConfig ¶
type FrontendConfig struct { // bind to address BindAddr string `json:"bind"` // frontend cache Cache *CacheConfig `json:"cache"` // frontend ssl settings SSL *SSLSettings `json:"ssl"` // static files directory Static string `json:"static_dir"` // http middleware configuration Middleware *MiddlewareConfig `json:"middleware"` }
type MiddlewareConfig ¶
type MiddlewareConfig struct { // middleware type, currently just 1 is available: overchan Type string `json:"type"` // directory for our html templates Templates string `json:"templates_dir"` }
configuration for http middleware
type NNTPHookConfig ¶
type NNTPHookConfig struct { // name of hook Name string `json:"name"` // executable script path to be called with arguments: /path/to/article Exec string `json:"exec"` }
config for external callback for nntp articles
type NNTPServerConfig ¶
type NNTPServerConfig struct { // address to bind to Bind string `json:"bind"` // name of the nntp server Name string `json:"name"` // default inbound article policy Article *ArticleConfig `json:"policy"` // do we allow anonymous NNTP sync? AnonNNTP bool `json:"anon-nntp"` // ssl settings for nntp SSL *SSLSettings // file with login credentials LoginsFile string `json:"authfile"` }
type ProxyConfig ¶
proxy configuration
type SSLSettings ¶
type SSLSettings struct { // path to ssl private key SSLKeyFile string `json:"key"` // path to ssl certificate signed by CA SSLCertFile string `json:"cert"` // domain name to use for ssl DomainName string `json:"fqdn"` }
settings for setting up ssl
type StoreConfig ¶
type StoreConfig struct { // path to article directory Path string `json:"path"` }
type WebhookConfig ¶
type WebhookConfig struct { // user provided name for this hook Name string `json:"name"` // callback URL for webhook URL string `json:"url"` // dialect to use when calling webhook Dialect string `json:"dialect"` }
configuration for a single web hook
Click to show internal directories.
Click to hide internal directories.