func (c *Client) Metadata() (*Metadata, error) {
	metadata := new(Metadata)
	err := c.doGetURL(c.resolve("/metadata/v1.json"), func(r io.Reader) error {
		return json.NewDecoder(r).Decode(metadata)
	})
	return metadata, err
}
Metadata contains the entire contents of a Droplet's metadata.
This method is unique because it returns all of the
metadata at once, instead of individual metadata items.
package metadata
import (
	"bufio"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"path"
	"time"
)
const (
	maxErrMsgLen = 128  
	defaultTimeout = 2 * time.Second
	defaultPath    = "/metadata/v1/"
)
var (
	defaultBaseURL = func() *url.URL {
		u, err := url.Parse("http://169.254.169.254")
		if err != nil {
			panic(err)
		}
		return u
	}()
)
type ClientOption func(*Client)
func WithHTTPClient(client *http.Client) ClientOption {
	return func(metaclient *Client) { metaclient.client = client }
}
func WithBaseURL(base *url.URL) ClientOption {
	return func(metaclient *Client) { metaclient.baseURL = base }
}
type Client struct {
	client  *http.Client
	baseURL *url.URL
}
func NewClient(opts ...ClientOption) *Client {
	client := &Client{
		client:  &http.Client{Timeout: defaultTimeout},
		baseURL: defaultBaseURL,
	}
	for _, opt := range opts {
		opt(client)
	}
	return client
}