Use variables for string matching

The legacy code does case matching on these exact strings so it's better
to ensure they're constant.
This commit is contained in:
Arlo Breault 2021-07-08 12:47:23 -04:00
parent 87ad06a5e2
commit c3c84fdb48
3 changed files with 7 additions and 5 deletions

View file

@ -177,10 +177,10 @@ func clientOffers(i *IPC, w http.ResponseWriter, r *http.Request) {
switch resp.Error {
case "":
response = []byte(resp.Answer)
case "no snowflake proxies currently available":
case messages.StrNoProxies:
w.WriteHeader(http.StatusServiceUnavailable)
return
case "timed out waiting for answer!":
case messages.StrTimedOut:
w.WriteHeader(http.StatusGatewayTimeout)
return
default: