| 145 | } |
| 146 | |
| 147 | func resolveAddress(addr []string) string { |
| 148 | switch len(addr) { |
| 149 | case 0: |
| 150 | if port := os.Getenv("PORT"); port != "" { |
| 151 | debugPrint("Environment variable PORT=\"%s\"", port) |
| 152 | return ":" + port |
| 153 | } |
| 154 | debugPrint("Environment variable PORT is undefined. Using port :8080 by default") |
| 155 | return ":8080" |
| 156 | case 1: |
| 157 | return addr[0] |
| 158 | default: |
| 159 | panic("too many parameters") |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // https://stackoverflow.com/questions/53069040/checking-a-string-contains-only-ascii-characters |
| 164 | func isASCII(s string) bool { |