Documentation ¶
Overview ¶
Package hasher includes functions and structures to ease the process of hashing the contents present in an URL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct{}
HTTPClient represents an implementation of an HTTPClient that uses the "net/http" package.
type HTTPHasher ¶
type HTTPHasher struct {
// contains filtered or unexported fields
}
HTTPHasher is an implementation of the interface Hasher, by doing an HTTP GET to the URL supplied and hashing the results with MD5.
func NewHTTPHasher ¶
func NewHTTPHasher(client Client) *HTTPHasher
NewHTTPHasher returns a new http-based hasher, using the client supplied.
type Hasher ¶
type Hasher interface { // Hash retrieves the md5 hash (as a string) of the contents of the url. Hash(url string) (string, error) }
Hasher is an interface that represents the capability of hashing the contents present in a URL.
type MockHasher ¶
type MockHasher struct {
// contains filtered or unexported fields
}
MockHasher is an implementation of the interface Hasher, that has an internal map of urls to hashes.
func NewMockHasher ¶
func NewMockHasher(hashMap map[string]string) *MockHasher
NewMockHasher returns a MockHasher with a certain map of urls to hashes.