config

package
v0.0.0-...-3a6820e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	IP    string `toml:"ip"`
	Port  uint16 `toml:"port"`
	User  string `toml:"user"`
	Token string `toml:"token"`
}

API : Rest API config

type Algorithm

type Algorithm struct {
	Name string `toml:"name"`
	Mode string
}

type ConfigToml

type ConfigToml struct {
	Project Project
	// Versions  Versions
	API       API
	DNS       DNS
	Keys      Keys
	Server    Server
	Database  Database
	Modules   map[string]Module
	TLSParams TLSParams
	Algorithm Algorithm
}

ConfigToml is the global config object

func LoadConfig

func LoadConfig(file string) (ConfigToml, error)

LoadConfig load the configuration file !

func (*ConfigToml) TLSBuildClientConf

func (c *ConfigToml) TLSBuildClientConf() (*tls.Config, error)

Build the TLS configuration for server

func (*ConfigToml) TLSBuildServerConf

func (c *ConfigToml) TLSBuildServerConf() (*tls.Config, error)

Build the TLS configuration for server

func (*ConfigToml) TLSReadCAFile

func (c *ConfigToml) TLSReadCAFile(caCert string) (*x509.CertPool, error)

Read CA file and initialise

type DNS

type DNS struct {
	Resolvers string `toml:"resolvers"`
}

DNS : Setup DNS resolver IP

type Database

type Database struct {
	User         string `toml:"user"`
	Database     string `toml:"database"`
	DatabaseType string `toml:"databaseType"`
	Password     string `toml:"password"`
	IP           string `toml:"ip"`
	Port         uint16 `toml:"port"`
}

Database : Mongodb config

type Keys

type Keys struct {
	Google string `toml:"google"`
	Shodan string `toml:"shodan"`
}

Keys : setup tocken & api keys

type Module

type Module struct {
	Enabled bool `toml:"enabled" json:"enabled"`
}

Module : Basic struct for general module config

type Project

type Project struct {
	Name        string `toml:"name" json:"name"`
	Description string `toml:"description" json:"description"`
}

type Server

type Server struct {
	Password string `toml:"password"`
	IP       string `toml:"ip"`
	Port     uint16 `toml:"port"`
}

Server : Master node config

type TLSParams

type TLSParams struct {

	// Enable TLS communications or not
	UseTLS bool `toml:"usetls"`

	// TLS Configuration to be set later
	TLSConfig *tls.Config

	// Certifcation Authority and Server Certificates
	CaCert     string `toml:"caCert"`
	ServerCert string `toml:"serverCert"`

	// These will later be deleted to be load dynamically for server and clients
	ServerPrivateKey string `toml:"serverPrivateKey"`
	ClientCert       string `toml:"clientCert"`
	ClientPrivateKey string `toml:"clientPrivateKey"`
}

TLS Certificates and keys

Jump to

Keyboard shortcuts

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