config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

Index

Constants

View Source
const (
	APP_NAME    = "arc"
	APP_VERSION = "1.4.0"
)

Variables

View Source
var Conf = Configuration{
	Tailscale: TailscaleConfig{
		Enabled:  defTailscale,
		Hostname: "",
	},
	Address:       defAddress,
	Port:          defPort,
	MaxReqSize:    defMaxReqSize,
	Certificate:   defCertificate,
	Key:           defKey,
	Database:      defDatabaseName,
	Secret:        defSecret,
	Username:      defUsername,
	Password:      defPassword,
	TokenDuration: defTokenDuration,
	Compression:   defCompression,
	Backups: BackupsConfig{
		Enabled: defBackupsEnabled,
	},
	Scheduler: SchedulerConfig{
		Enabled: true,
		Period:  defSchedulerPeriod,
		Reports: ReportsConfig{
			Enabled:   false,
			RateLimit: defRateLimit,
		},
	},
}

Functions

func Load

func Load(filename string) error

Load function convert a loaded JSON config file to a config struct return err if secret param is empty

Types

type BackupsConfig

type BackupsConfig struct {
	Enabled bool   `json:"enabled"`
	Period  int    `json:"period"`
	Folder  string `json:"folder"`
	Run     string `json:"run"`
}

Backups configuration.

type Configuration

type Configuration struct {
	Address       string          `json:"address"`
	Port          int             `json:"port"`
	MaxReqSize    int64           `json:"max_req_size"`
	Certificate   string          `json:"certificate"`
	Key           string          `json:"key"`
	Database      string          `json:"database"`
	Secret        string          `json:"secret"`
	Username      string          `json:"username"`
	Password      string          `json:"password"`
	TokenDuration int             `json:"token_duration"`
	Compression   bool            `json:"compression"`
	CheckExpired  int             `json:"check_expired"`
	Scheduler     SchedulerConfig `json:"scheduler"`
	Backups       BackupsConfig   `json:"backups"`
	Tailscale     TailscaleConfig `json:"tailscale"`
}

Arc server configuration. swagger:response

func (Configuration) Auth

func (c Configuration) Auth(username, password string) bool

Auth function return true if the provided username and password are valid and false if not.

func (Configuration) HashPassword

func (c Configuration) HashPassword(password string, cost int) string

HashPassword function return hashed string from a given password and cost

type KeyPair

type KeyPair struct {
	Public  string `json:"public"`
	Private string `json:"private"`
}

type PGPConfig

type PGPConfig struct {
	Enabled bool    `json:"enabled"`
	Keys    KeyPair `json:"keys"`
}

PGP configuration.

type ReportsConfig

type ReportsConfig struct {
	Enabled   bool       `json:"enabled"`
	RateLimit int        `json:"rate_limit"`
	Filter    []string   `json:"filter"`
	To        string     `json:"to"`
	PGP       PGPConfig  `json:"pgp"`
	SMTP      SMTPConfig `json:"smtp"`
}

Reports configuration.

type SMTPConfig

type SMTPConfig struct {
	Address  string `json:"address"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
}

SMTP configuration.

func (SMTPConfig) Filled added in v1.3.5

func (c SMTPConfig) Filled() bool

type SchedulerConfig

type SchedulerConfig struct {
	Enabled bool          `json:"enabled"`
	Period  int           `json:"period"`
	Reports ReportsConfig `json:"reports"`
}

Scheduler configuration.

type TailscaleConfig added in v1.4.0

type TailscaleConfig struct {
	Enabled  bool   `json:"enabled"`
	Hostname string `json:"hostname"`
	URL      string `json:"url"`
}

Tailscale optional configuration.

Jump to

Keyboard shortcuts

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