resolver

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxContentLength = 1024 * 1024 * 5 // 5MB
)

Variables

View Source
var (
	NoLinkInfoFound  []byte
	InvalidURL       []byte
	ResponseTooLarge []byte
)
View Source
var (
	ErrDontHandle = errors.New("dont handle in custom resolver")
)
View Source
var NoSpecialDur time.Duration

Functions

func CleanResponse

func CleanResponse(in string) string

func HTTPClient

func HTTPClient() *http.Client

func MatchesHosts

func MatchesHosts(url *url.URL, hosts map[string]struct{}) (bool, string)

func RequestGET

func RequestGET(url string) (response *http.Response, err error)

func RequestGETWithHeaders

func RequestGETWithHeaders(url string, extraHeaders map[string]string) (response *http.Response, err error)

Types

type CustomURLManager

type CustomURLManager struct {
	Check func(url *url.URL) bool
	Run   func(url *url.URL) ([]byte, error)
}

type Response

type Response struct {
	Status  int    `json:"status"`
	Message string `json:"message,omitempty"`

	Thumbnail string `json:"thumbnail,omitempty"`
	Tooltip   string `json:"tooltip,omitempty"`
	Link      string `json:"link,omitempty"`
}

type WriteLimiter

type WriteLimiter struct {
	Limit uint64
	// contains filtered or unexported fields
}

WriteLimiter can limit how many bytes can be written before erroring out

func (*WriteLimiter) Write

func (wc *WriteLimiter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL