|
|
@ -8,12 +8,9 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Nodes represents a set of nodes currently registered at the configured Discovery URL.
|
|
|
|
// DiscoResponse represents the response returned by a Discovery Service.
|
|
|
|
type Nodes []string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type DiscoResponse struct {
|
|
|
|
type DiscoResponse struct {
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
DiscoID string `json:"disco_id"`
|
|
|
|
DiscoID string `json:"disco_id"`
|
|
|
@ -42,8 +39,6 @@ func (c *Client) URL() string {
|
|
|
|
func (c *Client) Register(id, addr string) (*DiscoResponse, error) {
|
|
|
|
func (c *Client) Register(id, addr string) (*DiscoResponse, error) {
|
|
|
|
m := map[string]string{
|
|
|
|
m := map[string]string{
|
|
|
|
"addr": addr,
|
|
|
|
"addr": addr,
|
|
|
|
"GOOS": runtime.GOOS,
|
|
|
|
|
|
|
|
"GOARCH": runtime.GOARCH,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b, err := json.Marshal(m)
|
|
|
|
b, err := json.Marshal(m)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|