feature(server): allow to bind specific addresses (#263)
The main use case for ooniprobe is to bind 127.0.0.1 only.
This commit is contained in:
@@ -21,6 +21,7 @@ type ConfYaml struct {
|
||||
// SectionCore is sub section of config.
|
||||
type SectionCore struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Address string `yaml:"address"`
|
||||
Port string `yaml:"port"`
|
||||
MaxNotification int64 `yaml:"max_notification"`
|
||||
WorkerNum int64 `yaml:"worker_num"`
|
||||
@@ -128,6 +129,7 @@ func BuildDefaultPushConf() ConfYaml {
|
||||
var conf ConfYaml
|
||||
|
||||
// Core
|
||||
conf.Core.Address = ""
|
||||
conf.Core.Port = "8088"
|
||||
conf.Core.Enabled = true
|
||||
conf.Core.WorkerNum = int64(runtime.NumCPU())
|
||||
|
||||
@@ -55,6 +55,7 @@ func (suite *ConfigTestSuite) SetupTest() {
|
||||
|
||||
func (suite *ConfigTestSuite) TestValidateConfDefault() {
|
||||
// Core
|
||||
assert.Equal(suite.T(), "", suite.ConfGorushDefault.Core.Address)
|
||||
assert.Equal(suite.T(), "8088", suite.ConfGorushDefault.Core.Port)
|
||||
assert.Equal(suite.T(), true, suite.ConfGorushDefault.Core.Enabled)
|
||||
assert.Equal(suite.T(), int64(runtime.NumCPU()), suite.ConfGorushDefault.Core.WorkerNum)
|
||||
|
||||
Reference in New Issue
Block a user