func (c *Config) LoadDefaultConfig() (err error) {
	logger, _ := zap.NewDevelopment()
	c.HTTPSettings = DefaultHTTPClientSettings
	err = yaml.Unmarshal([]byte(DefaultConfigFileContent), c)
	if err != nil {
		logger.Error("load default config", zap.Error(err))
		return
	}
	c.InitHTTPClient()
	c.readCredentialFromEnv()
	return
}
LoadDefaultConfig loads the default configuration for Config.
It returns error if yaml decode failed.
package config
import (
	"errors"
	"io/ioutil"
	"net"
	"net/http"
	"net/url"
	"os"
	"strconv"
	"strings"
	"time"
	"go.uber.org/zap"
	"gopkg.in/yaml.v2"
	"github.com/qingstor/qingstor-sdk-go/v4/utils"
)
type Config struct {
	AccessKeyID     string `yaml:"access_key_id"`
	SecretAccessKey string `yaml:"secret_access_key"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Protocol string `yaml:"protocol"`
	Endpoint string `yaml:"endpoint"`
	AdditionalUserAgent string `yaml:"additional_user_agent"`
	DisableURICleaning  bool   `yaml:"disable_uri_cleaning"`
	LogLevel string `yaml:"log_level"`
	EnableVirtualHostStyle bool `yaml:"enable_virtual_host_style"`
	EnableDualStack bool `yaml:"enable_dual_stack"`
	HTTPSettings HTTPClientSettings
	Connection *http.Client
}
type HTTPClientSettings struct {
	ConnectTimeout time.Duration `yaml:"connect_timeout"`
	ReadTimeout time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout" `
	TLSHandshakeTimeout time.Duration `yaml:"tls_timeout"`
	IdleConnTimeout time.Duration `yaml:"idle_timeout"`
	TCPKeepAlive time.Duration `yaml:"tcp_keepalive_time"`
	DualStack bool `yaml:"dual_stack"`
	MaxIdleConns int `yaml:"max_idle_conns"`
	MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host"`
	ExpectContinueTimeout time.Duration `yaml:"expect_continue_timeout"`
}
var DefaultHTTPClientSettings = HTTPClientSettings{
	ConnectTimeout:        time.Second * 30,
	ReadTimeout:           time.Second * 30,
	WriteTimeout:          time.Second * 30,
	TLSHandshakeTimeout:   time.Second * 10,
	IdleConnTimeout:       time.Second * 20,
	TCPKeepAlive:          0,
	DualStack:             false,
	MaxIdleConns:          100,
	MaxIdleConnsPerHost:   10,
	ExpectContinueTimeout: time.Second * 2,
}
func New(accessKeyID, secretAccessKey string) (c *Config, err error) {
	c, err = NewDefault()
	if err != nil {
		c = nil
		return
	}
	c.AccessKeyID = accessKeyID
	c.SecretAccessKey = secretAccessKey
	return
}
func NewDefault() (c *Config, err error) {
	c = &Config{}
	err = c.LoadDefaultConfig()
	if err != nil {
		c = nil
		return
	}
	return
}
func (c *Config) Check() (err error) {
	if c.AccessKeyID == "" && c.SecretAccessKey != "" {
		err = errors.New("access key ID not specified")
		return
	}
	if c.SecretAccessKey == "" && c.AccessKeyID != "" {
		err = errors.New("secret access key not specified")
		return
	}
	if c.Endpoint == "" {
		if c.Host == "" {
			err = errors.New("server host not specified")
			return
		}
		if c.Port <= 0 {
			err = errors.New("server port not specified")
			return
		}
		if c.Protocol == "" {
			err = errors.New("server protocol not specified")
			return
		}
	}
	if c.AdditionalUserAgent != "" {
		for _, x := range c.AdditionalUserAgent {
			if int(x) < 32 || int(x) > 126 || int(x) == 32 || int(x) == 34 {
				err = errors.New("additional User-Agent contains characters that not allowed")
				return
			}
		}
	}
	ip := net.ParseIP(c.Host)
	if c.EnableVirtualHostStyle {
		if ip != nil {
			err = errors.New("Host is ip, cannot virtual host style")
			return
		}
	}
	if !c.EnableDualStack {
		if ip != nil && ip.To4() == nil {
			err = errors.New("Host is IPv6 address, enable_dual_stack should be true")
			return
		}
	}
	return
}