Documentation ¶
Index ¶
- Constants
- type Context
- func (ctx *Context) GetClientTLSConfig() (*tls.Config, error)
- func (ctx *Context) GetHTTPClient() (*http.Client, error)
- func (ctx *Context) GetServerTLSConfig() (*tls.Config, error)
- func (ctx *Context) HTTPRequestScheme() string
- func (ctx *Context) InitDefaults()
- func (ctx *Context) RPCRequestScheme() string
Constants ¶
const ( // NetworkTimeout is the timeout used for network operations. NetworkTimeout = 3 * time.Second )
Base context defaults.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // Insecure specifies whether to use SSL or not. // This is really not recommended. Insecure bool // Certs specifies a directory containing RSA key and x509 certs. // Required unless Insecure is true. Certs string // User running this process. It could be the user under which // the server is running ("node"), or the user passed in client calls. User string // contains filtered or unexported fields }
Context is embedded by server.Context. A base context is not meant to be used directly, but embedding contexts should call ctx.InitDefaults().
func (*Context) GetClientTLSConfig ¶
GetClientTLSConfig returns the context client TLS config, initializing it if needed. If Insecure is true, return a nil config, otherwise load a config based on the Certs directory. If Certs is empty, use a very permissive config. TODO(marc): empty Certs dir should fail when client certificates are required.
func (*Context) GetHTTPClient ¶
GetHTTPClient returns the context http client, initializing it if needed. It uses the context client TLS config.
func (*Context) GetServerTLSConfig ¶
GetServerTLSConfig returns the context server TLS config, initializing it if needed. If Insecure is true, return a nil config, otherwise load a config based on the Certs directory. Fails if Insecure=false and Certs="".
func (*Context) HTTPRequestScheme ¶
HTTPRequestScheme returns "http" or "https" based on the value of Insecure.
func (*Context) InitDefaults ¶
func (ctx *Context) InitDefaults()
InitDefaults sets up the default values for a context.
func (*Context) RPCRequestScheme ¶
RPCRequestScheme returns "rpc" or "rpcs" based on the value of Insecure.