commit 538751bb71922e628bb6dcc298fe2ecbc9ddbbd2 Author: Arlo Breault arlolra@gmail.com Date: Sun Mar 23 21:01:38 2014 -0700
Clean up --- handlers.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/handlers.go b/handlers.go index 27b6e40..e806048 100644 --- a/handlers.go +++ b/handlers.go @@ -40,16 +40,12 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain var ( err error isTor bool + host string + onOff string fingerprint string )
- // get remote ip - host, err := GetHost(r) - - // determine if we're in Tor - if err != nil { - isTor = false - } else { + if host, err = GetHost(r); err == nil { fingerprint, isTor = Exits.IsTor(host) }
@@ -61,7 +57,6 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain
// string used for classes and such // in the template - var onOff string if isTor { onOff = "on" } else { @@ -86,14 +81,12 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain
}
-type IPResp struct { - IsTor bool -} +type IPResp struct{ IsTor bool }
func APIHandler(Exits *Exits) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - isTor := false + var isTor bool if host, err := GetHost(r); err == nil { _, isTor = Exits.IsTor(host) }
tor-commits@lists.torproject.org