func (f *watchFwd) String(id sys.Id) string { var w bytes.Buffer fmt.Fprintf(&w, " Id:%s\n"+ " MyInTraffic: %d, MyOutTraffic: %d\n"+ " BehalfInTraffic: %d, BehalfOutTraffic: %d, LatencyPerByte: %g\n", id.Eye(), f.MyInTraffic, f.MyOutTraffic, f.OnBehalfInTraffic, f.OnBehalfOutTraffic, f.LatencyPerByte.GetAvg()) return w.String() }
func (f *watchFwd) toJSON(id sys.Id) string { var w bytes.Buffer fmt.Fprintf(&w, "{\"Id\":%s,\"MyInTraffic\":%d,\"MyOutTraffic\":%d,"+ "\"BehalfInTraffic\":%d,\"BehalfOutTraffic\":%d", id.ToJSON(), f.MyInTraffic, f.MyOutTraffic, f.OnBehalfInTraffic, f.OnBehalfOutTraffic) lat := f.LatencyPerByte.GetAvg() if math.IsNum(lat) { fmt.Fprintf(&w, ",\"LatencyPerByte\":%g}", lat) } else { fmt.Fprintf(&w, "}") } return w.String() }
func setOrigin(req *http.Request, id sys.Id) { if req.Header == nil { req.Header = make(map[string]string) } req.Header["Vault-Origin"] = id.Eye() }
func newDialerConn(rwc io.ReadWriteCloser, local, remote sys.Id) *dialerConn { return &dialerConn{rwc, dialerAddr(local.Eye()), dialerAddr(remote.Eye())} }