...

Package config

Overview ▾

Constants

const (
    DefaultMinSplitSize          = 10 * 1024 * 1024
    DefaultMinSplitSizeFormatted = "10 MiB"
    DefaultConnectTimeout        = 1 * time.Minute
    DefaultTransferTimeout       = 20 * time.Second
    DefaultMaxConnections        = 2
    DefaultAutoSaveControl       = 15 * time.Second
    DefaultRetryDelay            = 2 * time.Second
    DefaultMaxRetries            = 0
)

Variables

var C = &Config{
    MaxLogLevel:   LogNone,
    ProgressLevel: ProgressNone,

    Force:       false,
    Preallocate: true,

    ConnectTimeout:  DefaultConnectTimeout,
    TransferTimeout: DefaultTransferTimeout,

    Resume:          true,
    AutoSaveControl: DefaultAutoSaveControl,

    RetryDelay: DefaultRetryDelay,
    MaxRetries: DefaultMaxRetries,

    DownloadDir:  "./",
    DownloadName: "",

    MinSplitSize:   DefaultMinSplitSize,
    MaxConnections: DefaultMaxConnections,
}
var Version string
var WG = &sync.WaitGroup{}

type Config

type Config struct {
    MaxLogLevel LogLevel
    Debug       bool

    ProgressLevel ProgressLevel
    TaskWidth     int
    TaskFormat    string

    Force       bool
    Preallocate bool

    ConnectTimeout  time.Duration
    TransferTimeout time.Duration

    Resume          bool
    AutoSaveControl time.Duration

    RetryDelay time.Duration
    MaxRetries int

    DownloadDir  string
    DownloadName string

    MinSplitSize   int64
    MaxConnections int64

    UserAgent      string
    UserAgentExtra string
}

func (*Config) SetUserAgent

func (c *Config) SetUserAgent()

type LogLevel

type LogLevel int
const (
    LogNone LogLevel = iota
    LogStandard
    LogVerbose
)

type ProgressLevel

type ProgressLevel int
const (
    ProgressNone ProgressLevel = iota
    ProgressStatic
    ProgressDynamic
)