func (c *Client) DiscoverLinks(urlStr string, sel string) ([]string, error) {
	resp, err := c.Client.Get(urlStr)
	if err != nil {
		return nil, err
	}
	if code := resp.StatusCode; code < 200 || 300 <= code {
		return nil, fmt.Errorf("response error: %v", resp.StatusCode)
	}
	defer resp.Body.Close()
	return DiscoverLinksFromReader(resp.Body, urlStr, sel)
}
DiscoverLinks discovers URLs that the provided resource links to.  These are
candidates for sending webmentions to.  If non-empty, sel is a CSS selector
identifying the root node(s) to search in for links.
package webmention  
import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)
const (
	relWebmention  = "webmention"
	relLegacy      = "http://webmention.org"
	relLegacySlash = "http://webmention.org/"
)
type Client struct {
	*http.Client
}
func New(client *http.Client) *Client {
	if client == nil {
		client = http.DefaultClient
	}
	return &Client{Client: client}
}
func (c *Client) SendWebmention(endpoint, source, target string) (*http.Response, error) {
	resp, err := c.Client.PostForm(endpoint, url.Values{
		"source": []string{source},
		"target": []string{target},
	})
	if err != nil {
		return resp, err
	}
	if code := resp.StatusCode; code < 200 || 300 <= code {
		return resp, fmt.Errorf("response error: %v", resp.StatusCode)
	}
	return resp, nil
}
func (c *Client) DiscoverEndpoint(urlStr string) (string, error) {
	headEndpoint, err := c.discoverRequest(http.MethodHead, urlStr)
	if err == nil && headEndpoint != "" {
		return headEndpoint, nil
	}
	getEndpoint, err := c.discoverRequest(http.MethodGet, urlStr)
	if err == nil && getEndpoint != "" {
		return getEndpoint, nil
	}
	return "", err
}
func (c *Client) discoverRequest(method, urlStr string) (string, error) {
	req, err := http.NewRequest(method, urlStr, nil)
	if err != nil {
		return "", err
	}
	resp, err := c.Client.Do(req)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	if code := resp.StatusCode; code < 200 || 300 <= code {
		return "", fmt.Errorf("response error: %v", resp.StatusCode)
	}
	endpoint, err := extractEndpoint(resp)
	if err != nil {
		return "", err
	}
	urls, err := resolveReferences(resp.Request.URL.String(), endpoint)
	if err != nil {
		return "", err
	}
	return urls[0], nil
}
func extractEndpoint(resp *http.Response) (string, error) {
	if endpoint, err := httpLink(resp.Header); err == nil {
		return endpoint, nil
	}
	endpoint, err := htmlLink(resp.Body)
	if err != nil {
		return "", err
	}
	return endpoint, nil
}