Version: v1.0.4 Latest Latest

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

Go to latest
Published: Feb 9, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0




View Source
const (
	CurrentVer string = "v1.0.4"
	CurrentDSN string = ""

software version, sentry bug tracking id


This section is empty.


func CheckConfig

func CheckConfig(servConf ServConfig) int

CheckConfig : detect uri validity, check needed config for recaptcha, check max expire, check cryptography requirement

func FileExist

func FileExist(filepath string) bool

FileExist : check if file exists, utils


type Content

type Content struct {
	DetectAbuse bool `yaml:"detect_abuse"`
	ExpireHrs   int  `yaml:"expire_hrs"`

Content : subconfig about content abusing detection

type Network

type Network struct {
	Listen     string `yaml:"listen"`
	Host       string `yaml:"host"`
	MongodbURL string `yaml:"mongodb_url"`

Network : subconfig of ServConf

type Recaptcha

type Recaptcha struct {
	Enable    bool   `yaml:"enable"`
	SecretKey string `yaml:"secret_key,omitempty"`
	SiteKey   string `yaml:"site_key,omitempty"`

Recaptcha : subconfig of ServConf

type Security

type Security struct {
	MasterKey       string `yaml:"master_key"`
	EncryptionKey   string `yaml:"encryption_key"`
	EncryptionNonce string `yaml:"encryption_nonce"`

Security : subconfig about data encryption and administration must fulfill chacha20 standard

type ServConfig

type ServConfig struct {
	Network   Network   `yaml:"network"`
	Recaptcha Recaptcha `yaml:"recaptcha"`
	Security  Security  `yaml:"security"`
	Content   Content   `yaml:"content"`

ServConfig consists of 4 parts

var (
	ServConf ServConfig

global var for global server config read

func LoadConfig

func LoadConfig(filePath string) (ServConfig, error)

LoadConfig : config load function, read from file.

Source Files

Jump to

Keyboard shortcuts

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