|
|
@ -39,6 +39,11 @@ const ( |
|
|
|
TypeRestore = "restore" |
|
|
|
TypeRestore = "restore" |
|
|
|
TypeDump = "dump" |
|
|
|
TypeDump = "dump" |
|
|
|
TypeSync = "sync" |
|
|
|
TypeSync = "sync" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defaultHttpPort = 20881 |
|
|
|
|
|
|
|
defaultSystemPort = 20882 |
|
|
|
|
|
|
|
defaultSenderSize = 65535 |
|
|
|
|
|
|
|
defaultSenderCount = 1024 |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
func main() { |
|
|
@ -275,19 +280,32 @@ func sanitizeOptions(tp string) error { |
|
|
|
// pass, >= 0 means enable
|
|
|
|
// pass, >= 0 means enable
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if conf.Options.HttpProfile <= 0 || conf.Options.HttpProfile > 65535 { |
|
|
|
if conf.Options.HttpProfile < 0 || conf.Options.HttpProfile > 65535 { |
|
|
|
return fmt.Errorf("HttpProfile[%v] should in (0, 65535]", conf.Options.HttpProfile) |
|
|
|
return fmt.Errorf("HttpProfile[%v] should in [0, 65535]", conf.Options.HttpProfile) |
|
|
|
|
|
|
|
} else if conf.Options.HttpProfile == 0 { |
|
|
|
|
|
|
|
// set to default when not set
|
|
|
|
|
|
|
|
conf.Options.HttpProfile = defaultHttpPort |
|
|
|
} |
|
|
|
} |
|
|
|
if conf.Options.SystemProfile <= 0 || conf.Options.SystemProfile > 65535 { |
|
|
|
|
|
|
|
return fmt.Errorf("SystemProfile[%v] should in (0, 65535]", conf.Options.SystemProfile) |
|
|
|
if conf.Options.SystemProfile < 0 || conf.Options.SystemProfile > 65535 { |
|
|
|
|
|
|
|
return fmt.Errorf("SystemProfile[%v] should in [0, 65535]", conf.Options.SystemProfile) |
|
|
|
|
|
|
|
} else if conf.Options.SystemProfile == 0 { |
|
|
|
|
|
|
|
// set to default when not set
|
|
|
|
|
|
|
|
conf.Options.SystemProfile = defaultSystemPort |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if conf.Options.SenderSize <= 0 || conf.Options.SenderSize >= 1073741824 { |
|
|
|
if conf.Options.SenderSize < 0 || conf.Options.SenderSize >= 1073741824 { |
|
|
|
return fmt.Errorf("SenderSize[%v] should in (0, 1073741824]", conf.Options.SenderSize) |
|
|
|
return fmt.Errorf("SenderSize[%v] should in [0, 1073741824]", conf.Options.SenderSize) |
|
|
|
|
|
|
|
} else if conf.Options.SenderSize == 0 { |
|
|
|
|
|
|
|
// set to default when not set
|
|
|
|
|
|
|
|
conf.Options.SenderSize = defaultSenderSize |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if conf.Options.SenderCount <= 0 || conf.Options.SenderCount >= 100000 { |
|
|
|
if conf.Options.SenderCount < 0 || conf.Options.SenderCount >= 100000 { |
|
|
|
return fmt.Errorf("SenderCount[%v] should in (0, 100000]", conf.Options.SenderCount) |
|
|
|
return fmt.Errorf("SenderCount[%v] should in [0, 100000]", conf.Options.SenderCount) |
|
|
|
|
|
|
|
} else if conf.Options.SenderCount == 0 { |
|
|
|
|
|
|
|
// set to default when not set
|
|
|
|
|
|
|
|
conf.Options.SenderCount = defaultSenderCount |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if tp == TypeRestore || tp == TypeSync { |
|
|
|
if tp == TypeRestore || tp == TypeSync { |
|
|
|