(public bool)
| 234 | } |
| 235 | |
| 236 | func getIP(public bool) (string, error) { |
| 237 | var ip string |
| 238 | var err error |
| 239 | if public { |
| 240 | ip, err = GetPublicIP() |
| 241 | } else { |
| 242 | ip, err = getInternalIP() |
| 243 | } |
| 244 | if ip == "" { |
| 245 | ip = "localhost" |
| 246 | } |
| 247 | if err != nil { |
| 248 | return "localhost", err |
| 249 | } |
| 250 | return ip, nil |
| 251 | } |
| 252 | |
| 253 | // https://stackoverflow.com/a/23558495/15807350 |
| 254 | func getInternalIP() (string, error) { |
no test coverage detected