global

package
v0.0.0-...-0aeaaa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const REDIS_DID_CACHE_PREFIX = "cached_did:"
View Source
const REDIS_DID_CACHE_TTL = time.Hour * 24 * 7 // 1 week

Variables

View Source
var Logger log.Logger

global Log

View Source
var MailioDID *mailiodid.DID

var MailioDID *mailiodid.DID

View Source
var MailioKeysCreated int64
View Source
var PrivateKey ed25519.PrivateKey
View Source
var PublicKey ed25519.PublicKey

Public and Private key of a server (loaded from serverKeysPath in conf.yaml)

View Source
var RateLimiter *redis_rate.Limiter

Global rate limiter

Functions

func NewStdLogger

func NewStdLogger() (log.Logger, func() error, error)

NewStdLogger creates and returns a new logger that writes colored logs to stdout/stderr. NewStdLogger creates a new logger that prints colored logs to stdout/stderr.

Types

type Config

type Config struct {
	cfg.YamlConfig    `yaml:",inline"`
	CouchDB           CouchDBConfig        `yaml:"couchdb"`
	Mailio            MailioConfig         `yaml:"mailio"`
	Prometheus        PrometheusConfig     `yaml:"prometheus"`
	Redis             RedisConfig          `yaml:"redis"`
	Queue             Queue                `yaml:"queue"`
	SmtpServers       []*SmtpServerConfig  `yaml:"smtpservers"`
	DiskUsageHandlers []*DiskUsageHandlers `yaml:"diskusagehandlers"`
	Storage           StorageConfig        `yaml:"storage"`
	EmailStatistics   EmailStatistics      `yaml:"emailstatistics"`
}
var Conf Config

Conf global config

type CouchDBConfig

type CouchDBConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Scheme   string `yaml:"scheme"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type DiskUsageHandlers

type DiskUsageHandlers struct {
	Provider string `yaml:"provider"`
	Path     string `yaml:"path"`
}

type EmailStatistics

type EmailStatistics struct {
	SentKeyExpiry          int `yaml:"sentKeyExpiry"`          // in minutes
	SentKeyFlush           int `yaml:"sentKeyFlush"`           // in minutes
	InterestKeyExpiry      int `yaml:"interestKeyExpiry"`      // in minutes
	InterestKeyFlush       int `yaml:"interestKeyFlush"`       // in minutes
	SentRecvBySenderExpiry int `yaml:"sentRecvBySenderExpiry"` // in minutes
	SentRecvBySenderFlush  int `yaml:"sentRecvBySenderFlush"`  // in minutes
}

type MailDomains

type MailDomains struct {
	Domain       string `yaml:"domain"`
	SmtpPort     int    `yaml:"smtpPort"`
	SmtpServer   string `yaml:"smtpServer"`
	SmtpUsername string `yaml:"smtpUsername"`
	SmtpPassword string `yaml:"smtpPassword"`
}

type MailioConfig

type MailioConfig struct {
	DailySmtpSentLimit       int                           `yaml:"dailySmtpSentLimit"`
	DiskSpace                int64                         `yaml:"diskSpace"`
	AuthenticationPath       string                        `yaml:"authenticationPath"`
	MessagingPath            string                        `yaml:"messagingPath"`
	EmailDomain              string                        `yaml:"emailDomain"`
	ServerDomain             string                        `yaml:"serverDomain"`
	WebDomain                string                        `yaml:"webDomain"`
	ServerSubdomainQueryList []*MailioServerSubdomainQuery `yaml:"serverSubdomainQueryList"`
	ServerKeysPath           string                        `yaml:"serverKeysPath"`
	ServerHanshake           ServerHandshakeConfig         `yaml:"serverHandshake"`
	ReadVsReceived           int                           `yaml:"readVsReceived"`
}

type MailioServerSubdomainQuery

type MailioServerSubdomainQuery struct {
	Prefix string `yaml:"prefix"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Enabled  bool   `yaml:"enabled"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Queue

type Queue struct {
	Concurrency int `yaml:"concurrency"`
}

type RedisConfig

type RedisConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	Username string `yaml:"username"`
}

type ServerHandshakeConfig

type ServerHandshakeConfig struct {
	ID           string                         `yaml:"id"`
	OriginServer string                         `yaml:"originServer"`
	Type         int                            `yaml:"type"`
	MinimumLevel int                            `yaml:"minimumLevel"`
	Subtypes     []ServerHandshakeSubtypeConfig `yaml:"subtypes"`
}

type ServerHandshakeSubtypeConfig

type ServerHandshakeSubtypeConfig struct {
	Subtype          int `yaml:"subtype"`
	FrequencyMinutes int `yaml:"frequencyMinutes,omitempty"`
}

type SmtpServerConfig

type SmtpServerConfig struct {
	Provider   string         `yaml:"provider"`
	Webhookurl string         `yaml:"webhookurl"`
	Webhookkey string         `yaml:"webhookkey"`
	Domains    []*MailDomains `yaml:"domains"`
}

type StorageConfig

type StorageConfig struct {
	Type               string `yaml:"type"`
	Key                string `yaml:"key"`
	Secret             string `yaml:"secret"`
	Bucket             string `yaml:"bucket"`
	ProfilePhotoBucket string `yaml:"profilePhotoBucket"`
	Region             string `yaml:"region"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址