aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onrik/ethrpc/options.go
blob: 72ab398797a3c77487a19abec9b2f8ec38d8d61d (plain) (blame)
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
package ethrpc

import (
    "io"
    "net/http"
)

type httpClient interface {
    Post(url string, contentType string, body io.Reader) (*http.Response, error)
}

type logger interface {
    Println(v ...interface{})
}

// WithHttpClient set custom http client
func WithHttpClient(client httpClient) func(rpc *EthRPC) {
    return func(rpc *EthRPC) {
        rpc.client = client
    }
}

// WithLogger set custom logger
func WithLogger(l logger) func(rpc *EthRPC) {
    return func(rpc *EthRPC) {
        rpc.log = l
    }
}

// WithDebug set debug flag
func WithDebug(enabled bool) func(rpc *EthRPC) {
    return func(rpc *EthRPC) {
        rpc.Debug = enabled
    }
}