func (j *JoinRequest) Validate() error {
	if j.NodeID == "" {
		return fmt.Errorf("nodeID is empty")
	}
	_, err := net.DialTimeout("tcp", j.Addr, time.Second*3)
	if err != nil {
		return fmt.Errorf("invalid addr %v", err)
	}
	return nil
}
Validate validates the request
package util
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"time"
	"github.com/golang/glog"
	"github.com/pkg/errors"
	"github.com/sethgrid/pester"
)
type JoinRequest struct {
	NodeID string `json:"nodeID"`
	Addr   string `json:"addr"`
}