Documentation
¶
Overview ¶
This is a derived work based on `code.google.com/p/mlab-ns2/gae/ns/digest` (original work of Bipasa Chattopadhyay bipasa@cs.unc.edu Eric Gavaletz gavaletz@gmail.com Seon-Wook Park seon.wook@swook.net, from the fork maintained by Bob Ziuchkovski @bobziuchkovski (https://github.com/rkl-/digest).
Index ¶
- func NewClient(cfg ClientConfig) (*http.Client, error)
- func WithCACert(fpath string) func(*tls.Config) error
- func WithClientCertificate(cert, key string) func(*tls.Config) error
- func WithInsecureSkipVerify() func(*tls.Config)
- func WithTransport(rt http.RoundTripper) func(*http.Client)
- type ClientConfig
- type DigestAuthTransport
- type DumpTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(cfg ClientConfig) (*http.Client, error)
NewClient instantiates a new `http.Client` based on the client configuration supplied.
func WithInsecureSkipVerify ¶
func WithTransport ¶
func WithTransport(rt http.RoundTripper) func(*http.Client)
Types ¶
type ClientConfig ¶
type ClientConfig struct {
// TLSSkipVerify indicates that the client should not perform any
// hostname or certificate chain of trust validations.
//
TLSSkipVerify bool
// TLSClientCert is the path to a TLS client certificate to be used
// when connecting to a TLS server.
//
// ps.: must be supplied together with TLSClientKey.
//
TLSClientCert string
// TLSClientKey is the path to a TLS private key certificate to be used
// when connecting to a TLS server.
//
// ps.: must be supplied together with TLSClientCert.
//
TLSClientKey string
// TLSCACert is the path to a certificate authority certificate that
// should be included in the chain of trust.
//
TLSCACert string
// Verbose dictates whether the transport should dump all request and
// response information to stderr.
//
Verbose bool
// RequestTimeout places a deadline on every request issued by this
// client.
//
RequestTimeout time.Duration
// Username is the name of the user to send in the header of every HTTP
// call - must match the first portion of
// `--rpc-login=<username>:[password]` provided to `monerod`.
//
Username string
// Password is the user's password to send in the header of every HTTP
// call - must match the second portion of
// `--rpc-login=<username>:[password]` provided to `monerod` or the
// password interactively supplied during the daemon's startup.
//
// Note that because the `monerod` performs digest auth, the password
// won't be sent solely in plain base64 encoding, but the rest of the
// body of every request and response will still be cleartext.
//
Password string
}
ClientConfig provides extra configuration to tweak the behavior of the HTTP client instantiated via `NewClient`.
func (ClientConfig) Validate ¶
func (c ClientConfig) Validate() error
type DigestAuthTransport ¶
type DigestAuthTransport struct {
Username string
Password string
// contains filtered or unexported fields
}
DigestAuthTransport is an implementation of http.RoundTripper that takes care of http digest authentication.
func NewDigestAuthTransport ¶
func NewDigestAuthTransport( username, password string, rt http.RoundTripper, ) *DigestAuthTransport
NewDigestAuthTransport creates a new digest transport using the http.DefaultTransport.
type DumpTransport ¶
type DumpTransport struct {
R http.RoundTripper
}
DumpTransport implements the `net/http.RoundTripper` interface wrapping another Roundtripper dumping to stdout both the requests and the responses that it sees passing through.
func NewDumpTransport ¶
func NewDumpTransport(rt http.RoundTripper) *DumpTransport
NewDumpTransport instantiates a new DumpTransport.