Documentation ¶
Index ¶
- Variables
- func AuthenticateHttpRequest(getAuth func(string) (*api.AuthKey, bool), r *http.Request) (*api.AuthKey, error)
- func ExpandTilde(path string) string
- func GetHttpRequestSignature(secret string, r *http.Request) string
- func ListenAndServe(addr string, handler http.Handler) error
- func ListenAndServeWithTimeout(addr string, handler http.Handler, timeout time.Duration) error
- func SignHttpRequest(key *api.AuthKey, r *http.Request)
- type HttpClient
- func (h *HttpClient) DoJSON(c *http.Client, r *http.Request, resp interface{}) error
- func (h *HttpClient) Get(url string, resp interface{}) error
- func (h *HttpClient) GetRaw(url string) (*http.Response, error)
- func (h *HttpClient) GetRawRange(url string, beg, end int64) (*http.Response, error)
- func (h *HttpClient) NewRequest(method, relUrl string, data io.Reader) (*http.Request, error)
- func (h *HttpClient) Post(url string, req interface{}, resp interface{}) error
- func (h *HttpClient) Put(url string, in io.Reader, size int64, resp interface{}) error
- type RestartableTimer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Some incoming HTTP requests might take a long time to reach // the backend if we have a buffering proxy on the frontend // (for instance, NGINX). Relax the allowed delay. MaxTimeSkew = 12 * 3600.0 // Authorization errors. BadAuth = errors.New("Bad authenticated request") AuthFailed = errors.New("Authentication failed") )
Functions ¶
func AuthenticateHttpRequest ¶
func AuthenticateHttpRequest(getAuth func(string) (*api.AuthKey, bool), r *http.Request) (*api.AuthKey, error)
Authenticate checks the Authorization header in the request, and verifies its validity. It accepts a function to retrieve authentication keys from a database or other source.
func ExpandTilde ¶
func GetHttpRequestSignature ¶
GetHttpRequestSignature returns the signature of a HTTP request.
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func (*HttpClient) Get ¶
func (h *HttpClient) Get(url string, resp interface{}) error
func (*HttpClient) GetRawRange ¶
func (*HttpClient) NewRequest ¶
func (*HttpClient) Post ¶
func (h *HttpClient) Post(url string, req interface{}, resp interface{}) error
PostJSON performs a POST request with a JSON-encoded payload.
type RestartableTimer ¶
func NewRestartableTimer ¶
func NewRestartableTimer() *RestartableTimer
func (*RestartableTimer) Reset ¶
func (rt *RestartableTimer) Reset(d time.Duration)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Compute audio fingerprints of songs using the Echonest analyzers.
|
Compute audio fingerprints of songs using the Echonest analyzers. |
Click to show internal directories.
Click to hide internal directories.