-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
45 lines (37 loc) · 906 Bytes
/
config.go
File metadata and controls
45 lines (37 loc) · 906 Bytes
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
package bitcoincli
const (
RPC_REQUEST_TIMEOUT = 30
)
type BitcoinCliConfig struct {
IsTest bool
Host string
Port int
User string
Password string
UseSsl bool
Timeout int
WalletNotifyConfig *WalletNotifyConfig
}
type WalletNotifyConfig struct {
Host string
Port int
}
func NewDefaultBitcoinCliConfig() *BitcoinCliConfig {
return &BitcoinCliConfig{IsTest: true, Host: "127.0.0.1", Port: 17332, UseSsl: false, Timeout: RPC_REQUEST_TIMEOUT}
}
func (c *BitcoinCliConfig) WithUser(user string) *BitcoinCliConfig {
c.User = user
return c
}
func (c *BitcoinCliConfig) WithPassword(password string) *BitcoinCliConfig {
c.Password = password
return c
}
func (c *BitcoinCliConfig) WithTimeout(timeout int) *BitcoinCliConfig {
c.Timeout = timeout
return c
}
func (c *BitcoinCliConfig) WithWalletNotify(config *WalletNotifyConfig) *BitcoinCliConfig {
c.WalletNotifyConfig = config
return c
}