resolver

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 InitializeStaticResponses added in v1.2.0

func InitializeStaticResponses(cfg config.APIConfig)

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)

func RequestPOST added in v1.2.1

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

Types

type CustomURLManager

type CustomURLManager struct {
	Check func(url *url.URL) bool
	Run   func(url *url.URL, r *http.Request) ([]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