iris icon indicating copy to clipboard operation
iris copied to clipboard

[FEATURE REQUEST]Print all valid IP addresses when binding to addr any

Open achillis2016 opened this issue 11 months ago • 1 comments

I likes iris very much. When I used it to start a webserver with listen string "0.0.0.0:8889" or ":8889",when the program start up , it print some listening info like behind:

Now listening on: http://0.0.0.0:8889
Application started. Press CTRL+C to shut down.

I think this display info is very unfriendly. Like vite (a node.js develop server),when the bind address is "0.0.0.0",it will display all avalible ip address on this computer,just like this:

  vite v2.9.15 dev server running at:

  > Network:  http://192.168.26.1:3100/                                                                                                               12:52:31
  > Network:  http://192.168.164.1:3100/                                                                                                              12:52:31
  > Network:  http://192.168.131.17:3100/                                                                                                             12:52:31
  > Local:    http://localhost:3100/                                                                                                                  12:52:31

This is more useful than the url "http://0.0.0.0:8889" which can not be directly used on web browser or other places, so I hope there can be some improvement on this issue. Thank you very much!

achillis2016 avatar Jul 13 '23 05:07 achillis2016

Hello @achillis2016, sorry for the delay. I've made a commit which prints the web browser-accessible urls based on your request. Please upgrade using go get github.com/kataras/iris/v12@master and try it.

When :8080 or 0.0.0.0:8080:

Iris Version: 12.2.1

Now listening on:
> Network:  http://192.168.1.109:8080
> Network:  http://172.25.224.1:8080
> Local:    http://localhost:8080
Application started. Press CTRL+C to shut down.

Otherwise:

Iris Version: 12.2.1

Now listening on: http://192.168.1.109:8080
Application started. Press CTRL+C to shut down.

kataras avatar Jul 30 '23 18:07 kataras