mirror of
https://github.com/rqlite/rqlite.git
synced 2022-10-30 02:37:32 +03:00
GoDoc comments
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user