Documentation ¶
Overview ¶
Package besticon includes functions finding icons for a given web site.
Index ¶
- Constants
- Variables
- func CacheEnabled() bool
- func Get(urlstring string) (*http.Response, error)
- func GetBodyBytes(r *http.Response) ([]byte, error)
- func GetCacheStats() groupcache.CacheStats
- func MainColorForIcons(icons []Icon) *color.RGBA
- func SetCacheMaxSize(sizeInMB int64)
- func SetLogOutput(w io.Writer)
- type Icon
- type IconFinder
- type SizeRange
Constants ¶
View Source
const MaxIconSize = 500
TODO: Turn into env var: https://github.com/rendomnet/besticon/commit/c85867cc80c00c898053ce8daf40d51a93b9d39f#diff-37b57e3fdbe4246771791e86deb4d69dL41
View Source
const MinIconSize = 0
View Source
const VersionString = "v3.12.0"
Version string, same as VERSION, generated my Make
Variables ¶
View Source
var BuildDate string // set via ldflags on Make
View Source
var PopularSites []string
PopularSites we might use for examples and testing.
Functions ¶
func CacheEnabled ¶
func CacheEnabled() bool
func GetCacheStats ¶
func GetCacheStats() groupcache.CacheStats
GetCacheStats returns cache statistics.
func MainColorForIcons ¶
func SetCacheMaxSize ¶
func SetCacheMaxSize(sizeInMB int64)
SetCacheMaxSize enables icon caching if sizeInMB > 0.
func SetLogOutput ¶
SetLogOutput sets the output for the package's logger.
Types ¶
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 KeepImageBytes bool // 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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.