Skip to content

Commit 83e4e86

Browse files
committed
update
1 parent f83bcff commit 83e4e86

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.gitpod.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
tasks:
6+
- init: go get && go build ./... && go test ./...
7+
command: go run
8+
9+

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func init() {
3838
func main() {
3939
if open {
4040
go func() {
41-
if err := Open(fmt.Sprintf("http://127.0.0.1:%d", port)); err != nil {
41+
if err := Open(fmt.Sprintf("http://%s:%d", IP(), port)); err != nil {
4242
log.Printf("can not open default browser %s", err)
4343
}
4444
}()

net.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"net"
5+
)
6+
7+
func IP() string {
8+
conn, _ := net.Dial("udp", "8.8.8.8:80")
9+
10+
defer conn.Close()
11+
return conn.LocalAddr().(*net.UDPAddr).IP.String()
12+
}

0 commit comments

Comments
 (0)