Documentation
¶
Index ¶
- func NewTLSConfig(c *Config) (*tls.Config, error)
- type Config
- type HTTPClient
- type IRESTClient
- type RESTClient
- type Request
- func (r *Request) AddHeader(key, val string) *Request
- func (r *Request) Body(data []byte) *Request
- func (r *Request) Do() Result
- func (r *Request) JSON(success interface{}, failure interface{}) error
- func (r *Request) Param(name, value string) *Request
- func (r *Request) Stream() (io.ReadCloser, error)
- func (r *Request) URL() *url.URL
- type Result
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
BearerToken string
Timeout time.Duration
TLS *TLSConfig
Headers map[string]string
}
config holds the common attributes that can be passed to a Last.Backend client on initialization.
func (*Config) HasCA ¶
HasCA returns whether the configuration has a certificate authority or not.
func (*Config) HasCertAuth ¶
HasCertAuth returns whether the configuration has certificate authentication or not.
type IRESTClient ¶
type RESTClient ¶
func DefaultRESTClient ¶
func DefaultRESTClient(uri string) *RESTClient
func NewRESTClient ¶
func NewRESTClient(uri string, cfg *Config) (*RESTClient, error)
func (*RESTClient) Delete ¶
func (c *RESTClient) Delete(path string) *Request
func (*RESTClient) Do ¶
func (c *RESTClient) Do(verb string, path string) *Request
func (*RESTClient) Get ¶
func (c *RESTClient) Get(path string) *Request
func (*RESTClient) Post ¶
func (c *RESTClient) Post(path string) *Request
func (*RESTClient) Put ¶
func (c *RESTClient) Put(path string) *Request
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Stream ¶
func (r *Request) Stream() (io.ReadCloser, error)
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
type TLSConfig ¶
type TLSConfig struct {
// Server should be accessed without verifying the TLS certificate. For testing only.
Insecure bool
// Override for the server name passed to the server for SNI and used to verify certificates..
ServerName string
// Server requires TLS client certificate authentication
CertFile string
// Server requires TLS client certificate authentication
KeyFile string
// Trusted root certificates for server
CAFile string
// Bytes of the PEM-encoded server trusted root certificates. Supersedes CAFile.
CAData []byte
// Bytes of the PEM-encoded client certificate. Supersedes CertFile.
CertData []byte
// Bytes of the PEM-encoded client key. Supersedes KeyFile.
KeyData []byte
}
TLSConfig contains settings to enable transport layer security
Source Files
¶
- client.go
- config.go
- request.go
- tls.go
Click to show internal directories.
Click to hide internal directories.