|
4 | 4 | package main
|
5 | 5 |
|
6 | 6 | import (
|
7 |
| - "errors" |
8 | 7 | "flag"
|
9 | 8 | "fmt"
|
10 | 9 | "go/build"
|
11 | 10 | "log"
|
12 |
| - "net" |
13 | 11 | "net/http"
|
14 | 12 | "os"
|
15 | 13 | "path/filepath"
|
@@ -156,11 +154,7 @@ func main() {
|
156 | 154 | debug.SetGCPercent(-1)
|
157 | 155 | }
|
158 | 156 |
|
159 |
| - ip, err := externalIP() |
160 |
| - if err != nil { |
161 |
| - log.Println(err) |
162 |
| - } |
163 |
| - |
| 157 | + ip := "0.0.0.0" |
164 | 158 | log.Print("Starting server and websocket on " + ip + "" + f.Value.String())
|
165 | 159 | //homeTempl = template.Must(template.ParseFiles(filepath.Join(*assets, "home.html")))
|
166 | 160 |
|
@@ -218,51 +212,6 @@ func main() {
|
218 | 212 | setupSysTray()
|
219 | 213 | }
|
220 | 214 |
|
221 |
| -func externalIP() (string, error) { |
222 |
| - //log.Println("Getting external IP") |
223 |
| - ifaces, err := net.Interfaces() |
224 |
| - if err != nil { |
225 |
| - log.Println("Got err getting external IP addr") |
226 |
| - return "", err |
227 |
| - } |
228 |
| - for _, iface := range ifaces { |
229 |
| - if iface.Flags&net.FlagUp == 0 { |
230 |
| - //log.Println("Iface down") |
231 |
| - continue // interface down |
232 |
| - } |
233 |
| - if iface.Flags&net.FlagLoopback != 0 { |
234 |
| - //log.Println("Loopback") |
235 |
| - continue // loopback interface |
236 |
| - } |
237 |
| - addrs, err := iface.Addrs() |
238 |
| - if err != nil { |
239 |
| - log.Println("Got err on iface.Addrs()") |
240 |
| - return "", err |
241 |
| - } |
242 |
| - for _, addr := range addrs { |
243 |
| - var ip net.IP |
244 |
| - switch v := addr.(type) { |
245 |
| - case *net.IPNet: |
246 |
| - ip = v.IP |
247 |
| - case *net.IPAddr: |
248 |
| - ip = v.IP |
249 |
| - } |
250 |
| - if ip == nil || ip.IsLoopback() { |
251 |
| - //log.Println("Ip was nil or loopback") |
252 |
| - continue |
253 |
| - } |
254 |
| - ip = ip.To4() |
255 |
| - if ip == nil { |
256 |
| - //log.Println("Was not ipv4 addr") |
257 |
| - continue // not an ipv4 address |
258 |
| - } |
259 |
| - //log.Println("IP is ", ip.String()) |
260 |
| - return ip.String(), nil |
261 |
| - } |
262 |
| - } |
263 |
| - return "", errors.New("are you connected to the network?") |
264 |
| -} |
265 |
| - |
266 | 215 | var homeTemplate = template.Must(template.New("home").Parse(homeTemplateHtml))
|
267 | 216 |
|
268 | 217 | // If you navigate to this server's homepage, you'll get this HTML
|
|
0 commit comments