go-echarts/statsview

problems using 0.0.0.0 as serve address

simobgl opened this issue · 5 comments

Trying to expose the stats on all interfaces the same value is used building the page, and the browsers will then interpret 0.0.0.0 as localhost

@joegalaxy71 what is your expected result?

It should bind to 0.0.0.0 on the server, autodiscover a valid public IP and use that address to render the HTML, allowing statsview to be reachable from outside. Thank you for your work, it's a nice package.

Statsview provide a viewer.WithLinkAddr() method to set the request address to render the HTML hence you could put your public IP here

it could be reachable from outside by setting address as below:
viewer.SetConfiguration(viewer.WithAddr(":12345"), viewer.WithLinkAddr("11.82.205.147:12345"))

It would be hard to use in a cloud native golang app(because IP is not fixed, the container IP or service IP is always random).
@chenjiandongx has any idea?