Documentation
¶
Overview ¶
Package httpauthclient pkg/httpauthclient/client.go c0-com-http
Package httpauthclient pkg/httpauthclient/nonce.go c0-com-http
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractError ¶
ExtractError returns the decoded error message from Body.
func PayloadWithNonce ¶
PayloadWithNonce returns the concatenation of payload and nonce.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements Client for auth services.
func NewClient ¶
func NewClient(ctx context.Context, addr string, key cipher.PubKey, sec cipher.SecKey, client *http.Client, clientPublicIP string, mLog *logging.MasterLogger) (*Client, error)
NewClient creates a new client setting a public key to the client to be used for Auth. When keys are set, the client will sign request before submitting. The signature information is transmitted in the header using: * SW-Public: The specified public key * SW-Nonce: The nonce for that public key * SW-Sig: The signature of the payload + the nonce
func (*Client) Do ¶
Do performs a new authenticated Request and returns the response. Internally, if the request was successful nonce is incremented
func (*Client) IncrementNonce ¶
func (c *Client) IncrementNonce()
IncrementNonce increments client's current nonce.
func (*Client) SetPublicIPFunc ¶
SetPublicIPFunc makes the SW-PublicIP header follow fn, so a visor that moves to another network stops declaring the address it had at startup.
type Error ¶
type Error struct {
Error string `json:"error"`
}
Error is the object returned to the client when there's an error.
type HTTPResponse ¶
type HTTPResponse struct {
Error *HTTPError `json:"error,omitempty"`
Data interface{} `json:"data,omitempty"`
}
HTTPResponse represents the http response struct
type NextNonceResponse ¶
type NextNonceResponse struct {
Edge cipher.PubKey `json:"edge"`
NextNonce Nonce `json:"next_nonce"`
}
NextNonceResponse represents a ServeHTTP response for json encoding