config

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//GenerateKeys (cli) uses it for key pair
	GenerateKeys = cli.StringFlag{Name: "generate-keys", Value: "", Usage: "Generate a new keypair"}
	//ConfigFile (cli) uses it for config file name
	ConfigFile = cli.StringFlag{Name: "configfile", Value: "blackbox.conf", Usage: "Config file name"}
	//DBFile (cli) uses it for db file name
	DBFile = cli.StringFlag{Name: "dbfile", Value: "blackbox.db", Usage: "DB file name"}
	//PeersDBFile (cli) uses it for peer db file
	PeersDBFile = cli.StringFlag{Name: "peersdbfile", Value: "blackbox-peers.db", Usage: "Peers DB file name"}
	//Port (cli) uses it for local api public port
	Port = cli.StringFlag{Name: "port", Value: "9000", Usage: "Local port to the Public API"}
	//Hostaddr (cli) uses it for local api public binding Host Address
	Hostaddr = cli.StringFlag{Name: "hostaddr", Value: "127.0.0.1", Usage: "Local IP to bind the Public API"}
	//Socket (cli) uses it for socket
	Socket = cli.StringFlag{Name: "socket", Value: "blackbox.ipc", Usage: "IPC socket to the Private API"}
	//OtherNodes (cli) uses it for other nodes
	OtherNodes = cli.StringFlag{Name: "othernodes", Value: "", Usage: "\"Boot nodes\" to connect"}
	//PublicKeys (cli) uses it for  pub
	PublicKeys = cli.StringFlag{Name: "publickeys", Value: "", Usage: "Public keys"}
	//PrivateKeys (cli) uses it for pk
	PrivateKeys = cli.StringFlag{Name: "privatekeys", Value: "", Usage: "Private keys"}
	//Storage (cli) uses it for  db name
	Storage = cli.StringFlag{Name: "storage", Value: "blackbox.db", Usage: "Database file name"}
	//HostName (cli) uses it for hostname
	HostName = cli.StringFlag{Name: "hostname", Value: "http://localhost", Usage: "HostName is the PartyInfoRequest url argument by used by syncpeer.sync()"}

	//WorkDir (cli) uses it for work dir
	WorkDir = cli.StringFlag{Name: "workdir", Value: "../../", Usage: ""}
	//IsTLS (cli) uses it for enable/disable https
	IsTLS = cli.BoolFlag{Name: "tls", Usage: "Enable HTTPs communication"}
	//ServCert (cli) uses it for cert
	ServCert = cli.StringFlag{Name: "serv_cert", Value: "", Usage: ""}
	//ServKey (cli) uses it for key
	ServKey = cli.StringFlag{Name: "serv_key", Value: "", Usage: ""}

	//P2PDestination (cli) uses it for p2p dest
	P2PDestination = cli.StringFlag{Name: "p2p_dest", Value: "", Usage: ""}
	//P2PPort (cli) uses it for p2p port
	P2PPort = cli.StringFlag{Name: "p2p_port", Value: "", Usage: ""}
	//CPUProfiling (cli) uses it for CPU profiling data filename
	CPUProfiling = cli.StringFlag{Name: "cpuprofile", Value: "", Usage: "CPU profiling data filename"}
	//P2PEnabled (cli) uses it for enable / disable p2p
	P2PEnabled = cli.BoolFlag{Name: "p2p", Usage: "Enable p2p communication"}
	//RootCert  (cli) uses it for certs
	RootCert = cli.StringFlag{Name: "root_cert", Value: "", Usage: ""}
)

Functions

func Init

func Init(app *cli.App)

Init will init cli and logs

func LoadConfig

func LoadConfig(configPath string) error

LoadConfig will load cfg

func ReadPrimaryKey

func ReadPrimaryKey(pkFile string) ([]byte, error)

ReadPrimaryKey will read pk

func ReadPublicKey

func ReadPublicKey(pubFile string) ([]byte, error)

ReadPublicKey will read pub

Types

type Config

type Config struct {
	Server      Server   `json:"server"`
	HostName    string   `json:"hostName"`
	RootCA      []string `json:"rootCA,omitempty"`
	Peers       []Peer   `json:"peer"`
	Keys        Keys     `json:"keys"`
	UnixSocket  string   `json:"socket"`
	DBFile      string   `json:"dbfile,omitempty"`
	PeersDBFile string   `json:"peersdbfile,omitempty"`
}

Config json file specification

type Key

type Key struct {
	PrivateKeyFile string `json:"config"`
	PublicKeyFile  string `json:"publicKey"`
}

Key json file specification

type Keys

type Keys struct {
	Passwords []string `json:"passwords"`
	KeyData   []Key    `json:"keyData"`
}

Keys json file specification

type Peer

type Peer struct {
	URL string `json:"url"`
}

Peer json file specification

type PrivateKey

type PrivateKey struct {
	Data PrivateKeyBytes `json:"data"`
	Type string          `json:"type"`
}

PrivateKey holds data and type

type PrivateKeyBytes

type PrivateKeyBytes struct {
	Bytes string `json:"bytes"`
}

PrivateKeyBytes Start of Private Key json file specification

type Server

type Server struct {
	Port     int    `json:"port"`
	Hostaddr string `json:"hostaddr,omitempty"`
	TLSCert  string `json:"tlscert,omitempty"`
	TLSKey   string `json:"tlskey,omitempty"`
}

Server Start of Config json file specification

Jump to

Keyboard shortcuts

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