func contactSingle(e string, state *State) {
	body, err := json.Marshal(&WritePost{
		Dest:   e,
		Source: state.Hostname,
	})
	if err != nil {
		log.Fatalf("json marshal error: %v", err)
	}
	resp, err := http.Post(e+"/write", "application/json", bytes.NewReader(body))
	if err != nil {
		state.Logf("Warning: unable to contact the endpoint %q: %v", e, err)
		return
	}
	defer resp.Body.Close()

	body, err = ioutil.ReadAll(resp.Body)
	if err != nil {
		state.Logf("Warning: unable to read response from '%v': '%v'", e, err)
		return
	}
	var wr WriteResp
	err = json.Unmarshal(body, &wr)
	if err != nil {
		state.Logf("Warning: unable to unmarshal response (%v) from '%v': '%v'", string(body), e, err)
		return
	}
	state.appendSuccessfulSend(wr.Hostname)
}
// contactSingle dials the address 'e' and tries to POST to its /write address.
contactSingle dials the address 'e' and tries to POST to its /write address.
// contactSingle dials the address ' e ' and tries to POST to its / write address .
func contactSingle(e string, state *State) {
	body, err := json.Marshal(&WritePost{
		Dest:   e,
		Source: state.Hostname,
	})
	if err != nil {
		log.Fatalf("json marshal error: %v", err)
	}
	resp, err := http.Post(e+"/write", "application/json", bytes.NewReader(body))
	if err != nil {
		state.Logf("Warning: unable to contact the endpoint %q: %v", e, err)
		return
	}
	defer resp.Body.Close()
	body, err = ioutil.ReadAll(resp.Body)
	if err != nil {
		state.Logf("Warning: unable to read response from '%v': '%v'", e, err)
		return
	}
	var wr WriteResp
	err = json.Unmarshal(body, &wr)
	if err != nil {
		state.Logf("Warning: unable to unmarshal response (%v) from '%v': '%v'", string(body), e, err)
		return
	}
	state.appendSuccessfulSend(wr.Hostname)
}
func contactSingle ( e string , state * State ) { body , err := json . Marshal ( & WritePost { Dest : e , Source : state . Hostname , } ) if err != nil { log . Fatalf ( " " , err ) } resp , err := http . Post ( e + " " , " " , bytes . NewReader ( body ) ) if err != nil { state . Logf ( " " , e , err ) return } defer resp . Body . Close ( ) body , err = ioutil . ReadAll ( resp . Body ) if err != nil { state . Logf ( " " , e , err ) return } var wr WriteResp err = json . Unmarshal ( body , & wr ) if err != nil { state . Logf ( " " , string ( body ) , e , err ) return } state . appendSuccessfulSend ( wr . Hostname ) }
contactSingle dials the address 'e' and tries to POST to its /write address.
contactSingle dials the address ' e ' and tries to POST to its / write address .