GoDoc comments

This commit is contained in:
Philip O'Toole
2017-04-22 14:44:22 -07:00
committed by GitHub
parent a4e3698b85
commit 8ff3c7695b

View File

@@ -6,11 +6,13 @@ import (
"net/http"
)
// MetadataClient is a client for fetching AWS EC2 instance metadata.
type MetadataClient struct {
client *http.Client
URL string
}
// NewMetadataClient returns an instance of a MetadataClient
func NewMetadataClient() *MetadataClient {
return &MetadataClient{
client: &http.Client{},
@@ -18,10 +20,12 @@ func NewMetadataClient() *MetadataClient {
}
}
// LocalIPv4 returns the private IPv4 address of the instance.
func (m *MetadataClient) LocalIPv4() (string, error) {
return m.get("/latest/meta-data/local-ipv4")
}
// LocalIPv4 returns the public IPv4 address of the instance.
func (m *MetadataClient) PublicIPv4() (string, error) {
return m.get("/latest/meta-data/public-ipv4")
}