/
types.go
138 lines (124 loc) · 3.26 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package conf
type (
// HostPort endpoint in form "str:int"
HostPort struct {
Host string // ipaddr, hostname, or "0.0.0.0"
Port int // must be in range 1..65535
}
// DBConfig database connection parameters
DBConfig struct {
Name string
Host string
Port int
User string
Password string
LockTimeout int // lock_timeout in milliseconds
IdleInTxTimeout int // postgres parameter idle_in_transaction_session_timeout
MaxIdleConns int // sets the maximum number of connections in the idle connection pool
MaxOpenConns int // sets the maximum number of open connections to the database
}
//RedisConfig get redis information from config.yml
RedisConfig struct {
Enable bool
Host string
Port int
Password string
DbName int
}
// StatsDConfig statd connection parameters
StatsDConfig struct {
Host string
Port int
Name string
}
// CentrifugoConfig connection params
CentrifugoConfig struct {
Secret string
URL string
Key string
}
// Syslog represents parameters of syslog
Syslog struct {
Facility string
Tag string
}
// LogConfig represents parameters of log
LogConfig struct {
LogTo string
LogLevel string
LogFormat string
Syslog Syslog
}
// TokenMovementConfig smtp config for token movement
TokenMovementConfig struct {
Host string
Port int
Username string
Password string
To string
From string
Subject string
}
// BanKeyConfig parameters
BanKeyConfig struct {
BadTime int // control time period in minutes
BanTime int // ban time in minutes
BadTx int // maximum bad tx during badTime minutes
}
TLSConfig struct {
Enabled bool // TLS is on/off. It is required for https
TLSCert string // TLSCert is a filepath of the fullchain of certificate.
TLSKey string // TLSKey is a filepath of the private key.
}
DirectoryConfig struct {
DataDir string // application work dir (cwd by default)
PidFilePath string
LockFilePath string
TempDir string // temporary dir
KeysDir string // place for private keys files: NodePrivateKey, PrivateKey
FirstBlockPath string
}
BootstrapNodeConfig struct {
NodesAddr []string
}
CryptoSettings struct {
Cryptoer string
Hasher string
}
//LocalConfig TODO: uncategorized
LocalConfig struct {
RunNodeMode string
HTTPServerMaxBodySize int64
NetworkID int64
MaxPageGenerationTime int64 // in milliseconds
}
BlockSyncMethod struct {
Method string
}
// GlobalConfig is storing all startup config as global struct
GlobalConfig struct {
KeyID int64 `toml:"-"`
ConfigPath string `toml:"-"`
TestRollBack bool `toml:"-"`
FuncBench bool `toml:"-"`
LocalConf LocalConfig
DirPathConf DirectoryConfig
BootNodes BootstrapNodeConfig
TLSConf TLSConfig
TCPServer HostPort
HTTP HostPort
JsonRPC struct {
Enabled bool
Namespace string
}
DB DBConfig
Redis RedisConfig
StatsD StatsDConfig
Centrifugo CentrifugoConfig
Log LogConfig
TokenMovement TokenMovementConfig
BanKey BanKeyConfig
CryptoSettings CryptoSettings
BlockSyncMethod BlockSyncMethod
}
)