diff options
Diffstat (limited to 'vendor/github.com/onrik/ethrpc/options.go')
-rw-r--r-- | vendor/github.com/onrik/ethrpc/options.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/onrik/ethrpc/options.go b/vendor/github.com/onrik/ethrpc/options.go new file mode 100644 index 000000000..72ab39879 --- /dev/null +++ b/vendor/github.com/onrik/ethrpc/options.go @@ -0,0 +1,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 + } +} |