configs

package
v1.4.17 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 13 Imported by: 15

README

Configs

Small wrapper around the configs directory

Documentation

Index

Constants

View Source
const (
	// Sqlite - SQLite protocol
	Sqlite = "sqlite3"
	// Postgres - Postgresql protocol
	Postgres = "postgresql"
	// MySQL - MySQL protocol
	MySQL = "mysql"
)

Variables

View Source
var (
	// ErrInvalidDialect -
	ErrInvalidDialect = errors.New("Invalid SQL Dialect")
)

Functions

func GetDatabaseConfigPath

func GetDatabaseConfigPath() string

GetDatabaseConfigPath - File path to config.json

func GetServerConfigPath

func GetServerConfigPath() string

GetServerConfigPath - File path to config.json

Types

type DNSJobConfig

type DNSJobConfig struct {
	Domains  []string `json:"domains"`
	Canaries bool     `json:"canaries"`
	Host     string   `json:"host"`
	Port     uint16   `json:"port"`
	JobID    string   `json:"jobid"`
}

type DaemonConfig

type DaemonConfig struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

DaemonConfig - Configure daemon mode

type DatabaseConfig

type DatabaseConfig struct {
	Dialect  string `json:"dialect"`
	Database string `json:"database"`
	Username string `json:"username"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Port     uint16 `json:"port"`

	Params map[string]string `json:"params"`

	MaxIdleConns int `json:"max_idle_conns"`
	MaxOpenConns int `json:"max_open_conns"`

	LogLevel string `json:"log_level"`
}

DatabaseConfig - Server config

func GetDatabaseConfig

func GetDatabaseConfig() *DatabaseConfig

GetDatabaseConfig - Get config value

func (*DatabaseConfig) DSN

func (c *DatabaseConfig) DSN() (string, error)

DSN - Get the db connections string https://github.com/go-sql-driver/mysql#examples

func (*DatabaseConfig) Save

func (c *DatabaseConfig) Save() error

Save - Save config file to disk

type HTTPJobConfig

type HTTPJobConfig struct {
	Domain  string `json:"domain"`
	Host    string `json:"host"`
	Port    uint16 `json:"port"`
	Secure  bool   `json:"secure"`
	Website string `json:"website"`
	Cert    []byte `json:"cert"`
	Key     []byte `json:"key"`
	ACME    bool   `json:"acme"`
	JobID   string `json:"jobid"`
}

type JobConfig

type JobConfig struct {
	MTLS []*MTLSJobConfig `json:"mtls,omitempty"`
	WG   []*WGJobConfig   `json:"wg,omitempty"`
	DNS  []*DNSJobConfig  `json:"dns,omitempty"`
	HTTP []*HTTPJobConfig `json:"http,omitempty"`
}

JobConfig - Restart Jobs on Load

type LogConfig

type LogConfig struct {
	Level              int  `json:"level"`
	GRPCUnaryPayloads  bool `json:"grpc_unary_payloads"`
	GRPCStreamPayloads bool `json:"grpc_stream_payloads"`
}

LogConfig - Server logging config

type MTLSJobConfig

type MTLSJobConfig struct {
	Host  string `json:"host"`
	Port  uint16 `json:"port"`
	JobID string `json:"jobid"`
}

MTLSJobConfig - Per-type job configs

type ServerConfig

type ServerConfig struct {
	DaemonMode   bool              `json:"daemon_mode"`
	DaemonConfig *DaemonConfig     `json:"daemon"`
	Logs         *LogConfig        `json:"logs"`
	Jobs         *JobConfig        `json:"jobs,omitempty"`
	Watchtower   *WatchTowerConfig `json:"watch_tower"`
}

ServerConfig - Server config

func GetServerConfig

func GetServerConfig() *ServerConfig

GetServerConfig - Get config value

func (*ServerConfig) AddDNSJob

func (c *ServerConfig) AddDNSJob(config *DNSJobConfig) error

AddDNSJob - Add a persistent DNS job

func (*ServerConfig) AddHTTPJob

func (c *ServerConfig) AddHTTPJob(config *HTTPJobConfig) error

AddHTTPJob - Add a persistent job

func (*ServerConfig) AddMTLSJob

func (c *ServerConfig) AddMTLSJob(config *MTLSJobConfig) error

AddMTLSJob - Add Job Configs

func (*ServerConfig) AddWGJob added in v1.4.9

func (c *ServerConfig) AddWGJob(config *WGJobConfig) error

AddWGJob - Add Job Configs

func (*ServerConfig) RemoveJob

func (c *ServerConfig) RemoveJob(jobID string)

RemoveJob - Remove Job by ID

func (*ServerConfig) Save

func (c *ServerConfig) Save() error

Save - Save config file to disk

type WGJobConfig added in v1.4.9

type WGJobConfig struct {
	Port    uint16 `json:"port"`
	NPort   uint16 `json:"nport"`
	KeyPort uint16 `json:"key_port"`
	JobID   string `json:"jobid"`
}

WGJobConfig - Per-type job configs

type WatchTowerConfig added in v1.4.17

type WatchTowerConfig struct {
	VTApiKey          string `json:"vt_api_key"`
	XForceApiKey      string `json:"xforce_api_key"`
	XForceApiPassword string `json:"xforce_api_password"`
}

Jump to

Keyboard shortcuts

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