|
|
@ -34,8 +34,8 @@ import ( |
|
|
|
type Exit struct{ Code int } |
|
|
|
type Exit struct{ Code int } |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
|
defaultHttpPort = 20881 |
|
|
|
defaultHttpPort = 9320 |
|
|
|
defaultSystemPort = 20882 |
|
|
|
defaultSystemPort = 9310 |
|
|
|
defaultSenderSize = 65535 |
|
|
|
defaultSenderSize = 65535 |
|
|
|
defaultSenderCount = 1024 |
|
|
|
defaultSenderCount = 1024 |
|
|
|
) |
|
|
|
) |
|
|
@ -150,6 +150,10 @@ func initFreeOS() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func startHttpServer() { |
|
|
|
func startHttpServer() { |
|
|
|
|
|
|
|
if conf.Options.HttpProfile == -1 { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
utils.InitHttpApi(conf.Options.HttpProfile) |
|
|
|
utils.InitHttpApi(conf.Options.HttpProfile) |
|
|
|
utils.HttpApi.RegisterAPI("/conf", nimo.HttpGet, func([]byte) interface{} { |
|
|
|
utils.HttpApi.RegisterAPI("/conf", nimo.HttpGet, func([]byte) interface{} { |
|
|
|
return &conf.Options |
|
|
|
return &conf.Options |
|
|
@ -360,11 +364,13 @@ func sanitizeOptions(tp string) error { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if conf.Options.HttpProfile < 0 || conf.Options.HttpProfile > 65535 { |
|
|
|
if conf.Options.HttpProfile < -1 || 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 { |
|
|
|
} else if conf.Options.HttpProfile == 0 { |
|
|
|
// set to default when not set
|
|
|
|
// set to default when not set
|
|
|
|
conf.Options.HttpProfile = defaultHttpPort |
|
|
|
conf.Options.HttpProfile = defaultHttpPort |
|
|
|
|
|
|
|
} else if conf.Options.HttpProfile == -1 { |
|
|
|
|
|
|
|
log.Info("http_profile is disable") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if conf.Options.SystemProfile < 0 || conf.Options.SystemProfile > 65535 { |
|
|
|
if conf.Options.SystemProfile < 0 || conf.Options.SystemProfile > 65535 { |
|
|
|