nsqlookup/consul.go
func NewConsulEngine(config ConsulConfig) *ConsulEngine {
	if len(config.Address) == 0 {
		config.Address = DefaultConsulAddress
	}

	if len(config.Namespace) == 0 {
		config.Namespace = DefaultConsulNamespace
	}

	if config.NodeTimeout == 0 {
		config.NodeTimeout = DefaultLocalEngineNodeTimeout
	}

	if config.TombstoneTimeout == 0 {
		config.TombstoneTimeout = DefaultLocalEngineTombstoneTimeout
	}

	if !strings.Contains(config.Address, "://") {
		config.Address = "http://" + config.Address
	}

	return &ConsulEngine{
		client:      http.Client{Transport: config.Transport},
		address:     config.Address,
		namespace:   config.Namespace,
		nodeTimeout: config.NodeTimeout,
		tombTimeout: config.TombstoneTimeout,
	}
}
func NewConsulEngine(config ConsulConfig) *ConsulEngine {
	if len(config.Address) == 0 {
		config.Address = DefaultConsulAddress
	}

	if len(config.Namespace) == 0 {
		config.Namespace = DefaultConsulNamespace
	}

	if config.NodeTimeout == 0 {
		config.NodeTimeout = DefaultLocalEngineNodeTimeout
	}

	if config.TombstoneTimeout == 0 {
		config.TombstoneTimeout = DefaultLocalEngineTombstoneTimeout
	}

	if !strings.Contains(config.Address, "://") {
		config.Address = "http://" + config.Address
	}

	return &ConsulEngine{
		client:      http.Client{Transport: config.Transport},
		address:     config.Address,
		namespace:   config.Namespace,
		nodeTimeout: config.NodeTimeout,
		tombTimeout: config.TombstoneTimeout,
	}
}
// NewConsulEngine creates and return a new engine configured with config.