code: func (m *model) ConnectionStats() map[string]interface{} {
  	m.fmut.RLock()
  	m.pmut.RLock()
  	defer m.pmut.RUnlock()
  	defer m.fmut.RUnlock()
  
  	res := make(map[string]interface{})
  	devs := m.cfg.Devices()
  	conns := make(map[string]ConnectionInfo, len(devs))
  	for device, deviceCfg := range devs {
  		hello := m.helloMessages[device]
  		versionString := hello.ClientVersion
  		if hello.ClientName != "syncthing" {
  			versionString = hello.ClientName + " " + hello.ClientVersion
  		}
  		ci := ConnectionInfo{
  			ClientVersion: strings.TrimSpace(versionString),
  			Paused:        deviceCfg.Paused,
  		}
  		if conn, ok := m.conn[device]; ok {
  			ci.Type = conn.Type()
  			ci.Crypto = conn.Crypto()
  			ci.Connected = ok
  			ci.Statistics = conn.Statistics()
  			if addr := conn.RemoteAddr(); addr != nil {
  				ci.Address = addr.String()
  			}
  		}
  
  		conns[device.String()] = ci
  	}
  
  	res["connections"] = conns
  
  	in, out := protocol.TotalInOut()
  	res["total"] = ConnectionInfo{
  		Statistics: protocol.Statistics{
  			At:            time.Now(),
  			InBytesTotal:  in,
  			OutBytesTotal: out,
  		},
  	}
  
  	return res
  }
docs: // ConnectionStats returns a map with connection statistics for each device.