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:
@@ -36,13 +36,13 @@ func RunHTTPServer() (err error) {
|
||||
}
|
||||
|
||||
err = gracehttp.Serve(&http.Server{
|
||||
Addr: ":" + PushConf.Core.Port,
|
||||
Addr: PushConf.Core.Address + ":" + PushConf.Core.Port,
|
||||
Handler: routerEngine(),
|
||||
TLSConfig: config,
|
||||
})
|
||||
} else {
|
||||
err = gracehttp.Serve(&http.Server{
|
||||
Addr: ":" + PushConf.Core.Port,
|
||||
Addr: PushConf.Core.Address + ":" + PushConf.Core.Port,
|
||||
Handler: routerEngine(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ func RunHTTPServer() (err error) {
|
||||
s := autoTLSServer()
|
||||
err = s.ListenAndServeTLS("", "")
|
||||
} else if PushConf.Core.SSL && PushConf.Core.CertPath != "" && PushConf.Core.KeyPath != "" {
|
||||
err = http.ListenAndServeTLS(":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, routerEngine())
|
||||
err = http.ListenAndServeTLS(PushConf.Core.Address+":"+PushConf.Core.Port, PushConf.Core.CertPath, PushConf.Core.KeyPath, routerEngine())
|
||||
} else {
|
||||
err = http.ListenAndServe(":"+PushConf.Core.Port, routerEngine())
|
||||
err = http.ListenAndServe(PushConf.Core.Address+":"+PushConf.Core.Port, routerEngine())
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user