config

package
v0.8.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 14 Imported by: 41

Documentation

Index

Constants

View Source
const (
	MaxNumTxnPerBlock   = 4096
	ConsensusDuration   = 20 * time.Second
	ConsensusTimeout    = time.Minute
	DefaultMiningReward = 15
	MinNumSuccessors    = 8
	NodeIDBytes         = 32
	MaxRollbackBlocks   = 1
)
View Source
const (
	DefaultConfigFilename = "./config.json"
)

Variables

View Source
var (
	Version       string
	SkipCheckPort bool
	SkipNAT       bool

	Parameters = &Configuration{
		Version:      1,
		Transport:    "tcp",
		NodePort:     30001,
		HttpWsPort:   30002,
		HttpJsonPort: 30003,
		NAT:          true,
		LogLevel:     1,
		SeedList: []string{
			"http://127.0.0.1:30003",
		},
		SyncBatchWindowSize:       1024,
		SyncBlockHeadersBatchSize: 256,
		SyncBlocksBatchSize:       8,
		RPCReadTimeout:            5,
		RPCWriteTimeout:           10,
		KeepAliveTimeout:          15,
		NATPortMappingTimeout:     365 * 86400,
	}
)

Functions

func Init

func Init() error

Types

type Configuration

type Configuration struct {
	Version                   int           `json:"Version"`
	SeedList                  []string      `json:"SeedList"`
	RestCertPath              string        `json:"RestCertPath"`
	RestKeyPath               string        `json:"RestKeyPath"`
	RPCCert                   string        `json:"RPCCert"`
	RPCKey                    string        `json:"RPCKey"`
	HttpWsPort                uint16        `json:"HttpWsPort"`
	HttpJsonPort              uint16        `json:"HttpJsonPort"`
	NodePort                  uint16        `json:"-"`
	LogLevel                  int           `json:"LogLevel"`
	IsTLS                     bool          `json:"IsTLS"`
	CertPath                  string        `json:"CertPath"`
	KeyPath                   string        `json:"KeyPath"`
	CAPath                    string        `json:"CAPath"`
	GenBlockTime              uint          `json:"GenBlockTime"`
	EncryptAlg                string        `json:"EncryptAlg"`
	MaxLogSize                int64         `json:"MaxLogSize"`
	MaxTxInBlock              int           `json:"MaxTransactionInBlock"`
	MaxHdrSyncReqs            int           `json:"MaxConcurrentSyncHeaderReqs"`
	GenesisBlockProposer      string        `json:"GenesisBlockProposer"`
	Hostname                  string        `json:"Hostname"`
	Transport                 string        `json:"Transport"`
	NAT                       bool          `json:"NAT"`
	BeneficiaryAddr           string        `json:"BeneficiaryAddr"`
	SyncBatchWindowSize       uint32        `json:"SyncBatchWindowSize"`
	SyncBlockHeadersBatchSize uint32        `json:"SyncBlockHeadersBatchSize"`
	SyncBlocksBatchSize       uint32        `json:"SyncBlocksBatchSize"`
	RPCReadTimeout            time.Duration `json:"RPCReadTimeout"`        // in seconds
	RPCWriteTimeout           time.Duration `json:"RPCWriteTimeout"`       // in seconds
	KeepAliveTimeout          time.Duration `json:"KeepAliveTimeout"`      // in seconds
	NATPortMappingTimeout     time.Duration `json:"NATPortMappingTimeout"` // in seconds
}

func (*Configuration) CheckPorts

func (config *Configuration) CheckPorts(myIP string) (bool, error)

func (*Configuration) CleanPortMapping

func (config *Configuration) CleanPortMapping() error

func (*Configuration) SetupPortMapping

func (config *Configuration) SetupPortMapping() error

Jump to

Keyboard shortcuts

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