code: func DecodeConfig(r io.Reader) (*Config, error) {
  	var raw interface{}
  	dec := json.NewDecoder(r)
  	if err := dec.Decode(&raw); err != nil {
  		return nil, err
  	}
  
  	// Decode
  	var md mapstructure.Metadata
  	var result Config
  	msdec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
  		Metadata:    &md,
  		Result:      &result,
  		ErrorUnused: true,
  	})
  	if err != nil {
  		return nil, err
  	}
  
  	if err := msdec.Decode(raw); err != nil {
  		return nil, err
  	}
  
  	// Decode the time values
  	if result.ReconnectIntervalRaw != "" {
  		dur, err := time.ParseDuration(result.ReconnectIntervalRaw)
  		if err != nil {
  			return nil, err
  		}
  		result.ReconnectInterval = dur
  	}
  
  	if result.ReconnectTimeoutRaw != "" {
  		dur, err := time.ParseDuration(result.ReconnectTimeoutRaw)
  		if err != nil {
  			return nil, err
  		}
  		result.ReconnectTimeout = dur
  	}
  
  	if result.TombstoneTimeoutRaw != "" {
  		dur, err := time.ParseDuration(result.TombstoneTimeoutRaw)
  		if err != nil {
  			return nil, err
  		}
  		result.TombstoneTimeout = dur
  	}
  
  	if result.RetryIntervalRaw != "" {
  		dur, err := time.ParseDuration(result.RetryIntervalRaw)
  		if err != nil {
  			return nil, err
  		}
  		result.RetryInterval = dur
  	}
  
  	if result.BroadcastTimeoutRaw != "" {
  		dur, err := time.ParseDuration(result.BroadcastTimeoutRaw)
  		if err != nil {
  			return nil, err
  		}
  		result.BroadcastTimeout = dur
  	}
  
  	return &result, nil
  }
docs: // DecodeConfig reads the configuration from the given reader in JSON
  // format and decodes it into a proper Config structure.