Documentation ¶
Overview ¶
Package besticon includes functions finding icons for a given web site.
Index ¶
Constants ¶
View Source
const VersionString = "v3.14.0"
Version string, same as VERSION, generated my Make
Variables ¶
View Source
var BuildDate string // set via ldflags on Make
Functions ¶
func MainColorForIcons ¶
func NewDefaultHTTPClient ¶
func NewDefaultHTTPTransport ¶
func NewDefaultHTTPTransport(userAgent string) http.RoundTripper
Types ¶
type Besticon ¶
type Besticon struct {
// contains filtered or unexported fields
}
Besticon is the main interface to the besticon package.
func (*Besticon) CacheEnabled ¶
func (*Besticon) GetCacheStats ¶
func (b *Besticon) GetCacheStats() groupcache.CacheStats
GetCacheStats returns cache statistics.
func (*Besticon) NewIconFinder ¶
func (b *Besticon) NewIconFinder() *IconFinder
type Icon ¶
type Icon struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` Format string `json:"format"` Bytes int `json:"bytes"` Error error `json:"error"` Sha1sum string `json:"sha1sum"` ImageData []byte `json:",omitempty"` }
Icon holds icon information.
type IconFinder ¶
type IconFinder struct { FormatsAllowed []string HostOnlyDomains []string // contains filtered or unexported fields }
func (*IconFinder) FetchIcons ¶
func (f *IconFinder) FetchIcons(url string) ([]Icon, error)
func (*IconFinder) IconInSizeRange ¶
func (f *IconFinder) IconInSizeRange(r SizeRange) *Icon
func (*IconFinder) Icons ¶
func (f *IconFinder) Icons() []Icon
func (*IconFinder) MainColorForIcons ¶
func (f *IconFinder) MainColorForIcons() *color.RGBA
type Logger ¶
type Logger interface { LogError(err error) // LogResponse is called when an HTTP request has been executed. The duration is the time it took to execute the // request. When error is nil, the response is the response object. Otherwise, the response is nil. LogResponse(req *http.Request, resp *http.Response, duration time.Duration, err error) }
func NewDefaultLogger ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithDefaultFormats ¶
WithDefaultFormats sets the default accepted formats.
func WithDiscardImageBytes ¶
WithDiscardImageBytes sets whether to discard image bodies.
func WithHTTPClient ¶
WithHTTPClient sets the http client to use for requests.
func WithLogger ¶
WithLogger sets the logger to use for logging.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.