-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfig_file_types.go
More file actions
290 lines (256 loc) · 12.5 KB
/
config_file_types.go
File metadata and controls
290 lines (256 loc) · 12.5 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
package main
type serverConfig struct {
PoolListen string `toml:"pool_listen"`
StatusListen string `toml:"status_listen"`
StatusTLSListen *string `toml:"status_tls_listen"` // nil = default, "" = disabled
StatusPublicURL string `toml:"status_public_url"`
}
type brandingConfig struct {
StatusBrandName string `toml:"status_brand_name"`
StatusBrandDomain string `toml:"status_brand_domain"`
StatusTagline string `toml:"status_tagline"`
StatusConnectMinerTitleExtra string `toml:"status_connect_miner_title_extra"`
StatusConnectMinerTitleExtraURL string `toml:"status_connect_miner_title_extra_url"`
FiatCurrency string `toml:"fiat_currency"`
PoolDonationAddress string `toml:"pool_donation_address"`
ServerLocation string `toml:"server_location"`
}
// brandingConfigRead includes legacy fields that used to live under [branding]
// in config.toml before services.toml was introduced.
type brandingConfigRead struct {
StatusBrandName string `toml:"status_brand_name"`
StatusBrandDomain string `toml:"status_brand_domain"`
StatusTagline string `toml:"status_tagline"`
StatusConnectMinerTitleExtra string `toml:"status_connect_miner_title_extra"`
StatusConnectMinerTitleExtraURL string `toml:"status_connect_miner_title_extra_url"`
FiatCurrency string `toml:"fiat_currency"`
PoolDonationAddress string `toml:"pool_donation_address"`
ServerLocation string `toml:"server_location"`
DiscordURL string `toml:"discord_url"`
DiscordServerID string `toml:"discord_server_id"`
DiscordNotifyChannelID string `toml:"discord_notify_channel_id"`
}
type stratumConfig struct {
StratumTLSListen string `toml:"stratum_tls_listen"`
StratumPasswordEnabled bool `toml:"stratum_password_enabled"`
StratumPassword string `toml:"stratum_password"`
StratumPasswordPublic bool `toml:"stratum_password_public"`
SafeMode bool `toml:"safe_mode"`
}
type authConfig struct {
ClerkIssuerURL string `toml:"clerk_issuer_url"`
ClerkJWKSURL string `toml:"clerk_jwks_url"`
ClerkSignInURL string `toml:"clerk_signin_url"`
ClerkCallbackPath string `toml:"clerk_callback_path"`
ClerkFrontendAPIURL string `toml:"clerk_frontend_api_url"`
ClerkSessionCookieName string `toml:"clerk_session_cookie_name"`
ClerkSessionAudience string `toml:"clerk_session_audience"`
}
type nodeConfig struct {
RPCURL string `toml:"rpc_url"`
PayoutAddress string `toml:"payout_address"`
ZMQHashBlockAddr string `toml:"zmq_hashblock_addr"`
ZMQRawBlockAddr string `toml:"zmq_rawblock_addr"`
RPCCookiePath string `toml:"rpc_cookie_path"`
}
type nodeConfigRead struct {
RPCURL string `toml:"rpc_url"`
PayoutAddress string `toml:"payout_address"`
ZMQLegacyBlockAddr string `toml:"zmq_block_addr"`
ZMQHashBlockAddr string `toml:"zmq_hashblock_addr"`
ZMQRawBlockAddr string `toml:"zmq_rawblock_addr"`
RPCCookiePath string `toml:"rpc_cookie_path"`
}
type loggingConfig struct {
Debug *bool `toml:"debug"`
NetDebug *bool `toml:"net_debug"`
}
type backblazeBackupConfig struct {
Enabled bool `toml:"enabled"`
Bucket string `toml:"bucket"`
Prefix string `toml:"prefix"`
IntervalSeconds *int `toml:"interval_seconds"`
KeepLocalCopy *bool `toml:"keep_local_copy"`
ForceEveryInterval *bool `toml:"force_every_interval"`
SnapshotPath string `toml:"snapshot_path"`
}
type miningConfig struct {
PoolFeePercent *float64 `toml:"pool_fee_percent"`
OperatorDonationPercent *float64 `toml:"operator_donation_percent"`
OperatorDonationAddress string `toml:"operator_donation_address"`
OperatorDonationName string `toml:"operator_donation_name"`
OperatorDonationURL string `toml:"operator_donation_url"`
PoolEntropy *string `toml:"pool_entropy"`
PoolTagPrefix string `toml:"pooltag_prefix"`
}
type baseFileConfig struct {
Server serverConfig `toml:"server"`
Branding brandingConfig `toml:"branding"`
Stratum stratumConfig `toml:"stratum"`
Node nodeConfig `toml:"node"`
Mining miningConfig `toml:"mining"`
Logging loggingConfig `toml:"logging"`
}
type baseFileConfigRead struct {
Server serverConfig `toml:"server"`
Branding brandingConfigRead `toml:"branding"`
Stratum stratumConfig `toml:"stratum"`
Node nodeConfigRead `toml:"node"`
Mining miningConfig `toml:"mining"`
Logging loggingConfig `toml:"logging"`
Auth authConfig `toml:"auth"` // legacy location
Backblaze backblazeBackupConfig `toml:"backblaze_backup"` // legacy location
}
type servicesDiscordConfig struct {
DiscordURL string `toml:"discord_url"`
DiscordServerID string `toml:"discord_server_id"`
DiscordNotifyChannelID string `toml:"discord_notify_channel_id"`
WorkerNotifyThresholdSeconds *int `toml:"worker_notify_threshold_seconds"`
}
type servicesStatusConfig struct {
MempoolAddressURL string `toml:"mempool_address_url"`
GitHubURL string `toml:"github_url"`
}
type servicesFileConfig struct {
Auth authConfig `toml:"auth"`
Backblaze backblazeBackupConfig `toml:"backblaze_backup"`
Discord servicesDiscordConfig `toml:"discord"`
Status servicesStatusConfig `toml:"status"`
}
type rateLimitTuning struct {
MaxConns *int `toml:"max_conns"`
MaxAcceptsPerSecond *int `toml:"max_accepts_per_second"`
MaxAcceptBurst *int `toml:"max_accept_burst"`
DisableConnectRateLimits *bool `toml:"disable_connect_rate_limits"`
AutoAcceptRateLimits *bool `toml:"auto_accept_rate_limits"`
AcceptReconnectWindow *int `toml:"accept_reconnect_window"`
AcceptBurstWindow *int `toml:"accept_burst_window"`
AcceptSteadyStateWindow *int `toml:"accept_steady_state_window"`
AcceptSteadyStateRate *int `toml:"accept_steady_state_rate"`
AcceptSteadyStateReconnectPercent *float64 `toml:"accept_steady_state_reconnect_percent"`
AcceptSteadyStateReconnectWindow *int `toml:"accept_steady_state_reconnect_window"`
StratumMessagesPerMinute *int `toml:"stratum_messages_per_minute"`
}
type timeoutTuning struct {
ConnectionTimeoutSec *int `toml:"connection_timeout_seconds"`
}
type difficultyTuning struct {
MaxDifficulty *float64 `toml:"max_difficulty"`
MinDifficulty *float64 `toml:"min_difficulty"`
DefaultDifficulty *float64 `toml:"default_difficulty"`
TargetSharesPerMin *float64 `toml:"target_shares_per_min"`
VarDiffEnabled *bool `toml:"vardiff_enabled"`
LockSuggestedDifficulty *bool `toml:"lock_suggested_difficulty"`
EnforceSuggestedDifficultyLimits *bool `toml:"enforce_suggested_difficulty_limits"`
}
type miningTuning struct {
Extranonce2Size *int `toml:"extranonce2_size"`
TemplateExtraNonce2Size *int `toml:"template_extra_nonce2_size"`
JobEntropy *int `toml:"job_entropy"`
CoinbaseScriptSigMaxBytes *int `toml:"coinbase_scriptsig_max_bytes"`
DisablePoolJobEntropy *bool `toml:"disable_pool_job_entropy"`
DifficultyStepGranularity *int `toml:"difficulty_step_granularity"`
}
type hashrateTuning struct {
HashrateEMATauSeconds *float64 `toml:"hashrate_ema_tau_seconds"`
HashrateCumulativeEnabled *bool `toml:"hashrate_cumulative_enabled"`
HashrateRecentCumulativeEnabled *bool `toml:"hashrate_recent_cumulative_enabled"`
SavedWorkerHistoryFlushIntervalSec *int `toml:"saved_worker_history_flush_interval_seconds"`
ShareNTimeMaxForwardSeconds *int `toml:"share_ntime_max_forward_seconds"`
}
type peerCleaningTuning struct {
Enabled *bool `toml:"enabled"`
MaxPingMs *float64 `toml:"max_ping_ms"`
MinPeers *int `toml:"min_peers"`
}
type banTuning struct {
CleanExpiredOnStartup *bool `toml:"clean_expired_on_startup"`
BanInvalidSubmissionsAfter *int `toml:"ban_invalid_submissions_after"`
BanInvalidSubmissionsWindowSec *int `toml:"ban_invalid_submissions_window_seconds"`
BanInvalidSubmissionsDurationSec *int `toml:"ban_invalid_submissions_duration_seconds"`
ReconnectBanThreshold *int `toml:"reconnect_ban_threshold"`
ReconnectBanWindowSeconds *int `toml:"reconnect_ban_window_seconds"`
ReconnectBanDurationSeconds *int `toml:"reconnect_ban_duration_seconds"`
BannedMinerTypes []string `toml:"banned_miner_types"`
}
type versionTuning struct {
MinVersionBits *int `toml:"min_version_bits"`
ShareAllowVersionMaskMismatch *bool `toml:"share_allow_version_mask_mismatch"`
ShareAllowDegradedVersionBits *bool `toml:"share_allow_degraded_version_bits"`
BIP110Enabled *bool `toml:"bip110_enabled"`
}
// fileOverrideConfig groups override sections used internally when applying
// policy/tuning overlays.
type fileOverrideConfig struct {
RateLimits rateLimitTuning `toml:"rate_limits"`
Timeouts timeoutTuning `toml:"timeouts"`
Difficulty difficultyTuning `toml:"difficulty"`
Mining miningTuning `toml:"mining"`
Hashrate hashrateTuning `toml:"hashrate"`
PeerCleaning peerCleaningTuning `toml:"peer_cleaning"`
Bans banTuning `toml:"bans"`
Version versionTuning `toml:"version"`
}
type policyMiningConfig struct {
ShareJobFreshnessMode *int `toml:"share_job_freshness_mode"`
ShareCheckNTimeWindow *bool `toml:"share_check_ntime_window"`
ShareCheckVersionRolling *bool `toml:"share_check_version_rolling"`
ShareRequireAuthorizedConnection *bool `toml:"share_require_authorized_connection"`
ShareCheckParamFormat *bool `toml:"share_check_param_format"`
ShareRequireWorkerMatch *bool `toml:"share_require_worker_match"`
SubmitProcessInline *bool `toml:"submit_process_inline"`
ShareCheckDuplicate *bool `toml:"share_check_duplicate"`
}
type policyHashrateConfig struct {
ShareNTimeMaxForwardSeconds *int `toml:"share_ntime_max_forward_seconds"`
}
type policyStratumConfig struct {
CKPoolEmulate *bool `toml:"ckpool_emulate"`
}
type policyFileConfig struct {
Mining policyMiningConfig `toml:"mining"`
Stratum policyStratumConfig `toml:"stratum"`
Hashrate policyHashrateConfig `toml:"hashrate"`
Version versionTuning `toml:"version"`
Bans banTuning `toml:"bans"`
Timeouts timeoutTuning `toml:"timeouts"`
}
type tuningHashrateConfig struct {
HashrateEMATauSeconds *float64 `toml:"hashrate_ema_tau_seconds"`
HashrateCumulativeEnabled *bool `toml:"hashrate_cumulative_enabled"`
HashrateRecentCumulativeEnabled *bool `toml:"hashrate_recent_cumulative_enabled"`
SavedWorkerHistoryFlushIntervalSec *int `toml:"saved_worker_history_flush_interval_seconds"`
}
type tuningStratumConfig struct {
FastDecodeEnabled *bool `toml:"fast_decode_enabled"`
FastEncodeEnabled *bool `toml:"fast_encode_enabled"`
TCPReadBufferBytes *int `toml:"tcp_read_buffer_bytes"`
TCPWriteBufferBytes *int `toml:"tcp_write_buffer_bytes"`
}
type tuningFileConfig struct {
RateLimits rateLimitTuning `toml:"rate_limits"`
Difficulty difficultyTuning `toml:"difficulty"`
Mining miningTuning `toml:"mining"`
Hashrate tuningHashrateConfig `toml:"hashrate"`
Stratum tuningStratumConfig `toml:"stratum"`
PeerCleaning peerCleaningTuning `toml:"peer_cleaning"`
}
type versionBitOverride struct {
Bit int `toml:"bit"`
Enabled bool `toml:"enabled"`
}
type versionBitsFileConfig struct {
Bits []versionBitOverride `toml:"bits"`
}
// secretsConfig holds values from secrets.toml: Clerk secrets and (when enabled)
// RPC user/password for fallback authentication. This file is gitignored so only
// store sensitive credentials here.
type secretsConfig struct {
RPCUser string `toml:"rpc_user"`
RPCPass string `toml:"rpc_pass"`
DiscordBotToken string `toml:"discord_token"`
ClerkSecretKey string `toml:"clerk_secret_key"`
ClerkPublishableKey string `toml:"clerk_publishable_key"`
BackblazeAccountID string `toml:"backblaze_account_id"`
BackblazeApplicationKey string `toml:"backblaze_application_key"`
}