Skip to content

Commit db63289

Browse files
committed
Merge pull request #76 from arduino/localhost
Only listen to localhost by default
2 parents 572fc10 + 786ee82 commit db63289

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545
port string
4646
portSSL string
4747
origins = flag.String("origins", "", "Allowed origin list for CORS")
48+
address = flag.String("address", "127.0.0.1", "The address where to listen. Defaults to localhost")
4849
)
4950

5051
type NullWriter int
@@ -257,7 +258,7 @@ func main() {
257258
for i < end {
258259
i = i + 1
259260
portSSL = ":" + strconv.Itoa(i)
260-
if err := r.RunTLS(portSSL, filepath.Join(dest, "cert.pem"), filepath.Join(dest, "key.pem")); err != nil {
261+
if err := r.RunTLS(*address+portSSL, filepath.Join(dest, "cert.pem"), filepath.Join(dest, "key.pem")); err != nil {
261262
log.Printf("Error trying to bind to port: %v, so exiting...", err)
262263
continue
263264
} else {
@@ -275,7 +276,7 @@ func main() {
275276
for i < end {
276277
i = i + 1
277278
port = ":" + strconv.Itoa(i)
278-
if err := r.Run(port); err != nil {
279+
if err := r.Run(*address + port); err != nil {
279280
log.Printf("Error trying to bind to port: %v, so exiting...", err)
280281
continue
281282
} else {

0 commit comments

Comments
 (0)