func NewConfig() *Config {
	c := &Config{}
	c.Net.MaxOpenRequests = 5
	c.Net.DialTimeout = 30 * time.Second
	c.Net.ReadTimeout = 30 * time.Second
	c.Net.WriteTimeout = 30 * time.Second
	c.Net.SASL.Handshake = true
	c.Metadata.Retry.Max = 3
	c.Metadata.Retry.Backoff = 250 * time.Millisecond
	c.Metadata.RefreshFrequency = 10 * time.Minute
	c.Metadata.Full = true
	c.Producer.MaxMessageBytes = 1000000
	c.Producer.RequiredAcks = WaitForLocal
	c.Producer.Timeout = 10 * time.Second
	c.Producer.Partitioner = NewHashPartitioner
	c.Producer.Retry.Max = 3
	c.Producer.Retry.Backoff = 100 * time.Millisecond
	c.Producer.Return.Errors = true
	c.Consumer.Fetch.Min = 1
	c.Consumer.Fetch.Default = 1024 * 1024
	c.Consumer.Retry.Backoff = 2 * time.Second
	c.Consumer.MaxWaitTime = 250 * time.Millisecond
	c.Consumer.MaxProcessingTime = 100 * time.Millisecond
	c.Consumer.Return.Errors = false
	c.Consumer.Offsets.CommitInterval = 1 * time.Second
	c.Consumer.Offsets.Initial = OffsetNewest
	c.ClientID = defaultClientID
	c.ChannelBufferSize = 256
	c.Version = minVersion
	c.MetricRegistry = metrics.NewRegistry()
	return c
}
NewConfig returns a new configuration instance with sane defaults.
package sarama
import (
	"crypto/tls"
	"regexp"
	"time"
	"github.com/rcrowley/go-metrics"
)
const defaultClientID = "sarama"
var validID = regexp.MustCompile(`\A[A-Za-z0-9._-]+\z`)
type Config struct {
	Net struct {
		MaxOpenRequests int
		DialTimeout  time.Duration  
		ReadTimeout  time.Duration  
		WriteTimeout time.Duration  
		TLS struct {
			Enable bool
			Config *tls.Config
		}
		SASL struct {
			Enable bool
			Handshake bool
			User     string
			Password string
		}
		KeepAlive time.Duration
	}
	Metadata struct {
		Retry struct {
			Max int
			Backoff time.Duration
		}
		RefreshFrequency time.Duration
		Full bool
	}
	Producer struct {
		MaxMessageBytes int
		RequiredAcks RequiredAcks
		Timeout time.Duration
		Compression CompressionCodec
		Partitioner PartitionerConstructor
		Return struct {
			Successes bool
			Errors bool
		}
		Flush struct {
			Bytes int
			Messages int
			Frequency time.Duration
			MaxMessages int
		}
		Retry struct {
			Max int
			Backoff time.Duration
		}
	}
	Consumer struct {
		Retry struct {
			Backoff time.Duration
		}
		Fetch struct {
			Min int32
			Default int32
			Max int32
		}
		MaxWaitTime time.Duration
		MaxProcessingTime time.Duration
		Return struct {
			Errors bool
		}
		Offsets struct {
			CommitInterval time.Duration
			Initial int64
			Retention time.Duration
		}
	}
	ClientID string
	ChannelBufferSize int
	Version KafkaVersion
	MetricRegistry metrics.Registry
}