@@ -747,13 +747,11 @@ func (g *LightningTerminal) showStartupInfo() error {
747
747
}
748
748
749
749
// If there's an additional HTTP listener, list it as well.
750
+ listenAddr := g .cfg .HTTPSListen
750
751
if g .cfg .HTTPListen != "" {
751
- host := strings .ReplaceAll (
752
- strings .ReplaceAll (
753
- g .cfg .HTTPListen , "0.0.0.0" , "localhost" ,
754
- ), "[::]" , "localhost" ,
755
- )
756
- info .webURI = fmt .Sprintf ("%s, http://%s" , info .webURI , host )
752
+ host := toLocalAddress (listenAddr )
753
+ info .webURI = fmt .Sprintf ("%s or http://%s" , info .webURI , host )
754
+ listenAddr = fmt .Sprintf ("%s, %s" , listenAddr , g .cfg .HTTPListen )
757
755
}
758
756
759
757
str := "" +
@@ -764,10 +762,10 @@ func (g *LightningTerminal) showStartupInfo() error {
764
762
" Node status %s \n " +
765
763
" Alias %s \n " +
766
764
" Version %s \n " +
767
- " Web interface %s \n " +
765
+ " Web interface %s (open %s in your browser) \n " +
768
766
"----------------------------------------------------------\n "
769
767
fmt .Printf (str , info .mode , info .status , info .alias , info .version ,
770
- info .webURI )
768
+ listenAddr , info .webURI )
771
769
772
770
return nil
773
771
}
@@ -790,3 +788,10 @@ func (i *ClientRouteWrapper) Open(name string) (http.File, error) {
790
788
791
789
return i .assets .Open ("/index.html" )
792
790
}
791
+
792
+ // toLocalAddress converts an address that is meant as a wildcard listening
793
+ // address ("0.0.0.0" or "[::]") into an address that can be dialed (localhost).
794
+ func toLocalAddress (listenerAddress string ) string {
795
+ addr := strings .ReplaceAll (listenerAddress , "0.0.0.0" , "localhost" )
796
+ return strings .ReplaceAll (addr , "[::]" , "localhost" )
797
+ }
0 commit comments