tAdd cleanups to binaries. - tordam - A library for peer discovery inside the Tor network
 (HTM) git clone https://git.parazyd.org/tordam
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e39896f6b0f2298df068319b0941ca2c48912af8
 (DIR) parent c787512bf95b13fd861fa7d881d2e10dbfb408d0
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Tue, 13 Mar 2018 13:32:38 +0100
       
       Add cleanups to binaries.
       
       Diffstat:
         M cmd/dam-client/main.go              |       2 +-
         M cmd/dam-dir/main.go                 |       4 +---
         M cmd/dam-dir/main_test.go            |      13 ++++---------
       
       3 files changed, 6 insertions(+), 13 deletions(-)
       ---
 (DIR) diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go
       t@@ -87,7 +87,7 @@ func announce(dir string, vals map[string]string, privkey *rsa.PrivateKey) (bool
                                return false, err
                        }
        
       -                decrypted, err := lib.DecryptMsgRsa([]byte(decodedSecret), privkey)
       +                decrypted, err := lib.DecryptMsgRsa(decodedSecret, privkey)
                        if err != nil {
                                return false, err
                        }
 (DIR) diff --git a/cmd/dam-dir/main.go b/cmd/dam-dir/main.go
       t@@ -209,9 +209,7 @@ func handlePost(rw http.ResponseWriter, request *http.Request) {
        
        // handleElse is a noop for anything that isn't /announce. We don't care about
        // other requests (yet).
       -func handleElse(rw http.ResponseWriter, request *http.Request) {
       -        return
       -}
       +func handleElse(rw http.ResponseWriter, request *http.Request) {}
        
        func main() {
                var wg sync.WaitGroup
 (DIR) diff --git a/cmd/dam-dir/main_test.go b/cmd/dam-dir/main_test.go
       t@@ -63,11 +63,7 @@ func getRespText(resp *http.Response) (msgStruct, error) {
        
                decoder := json.NewDecoder(resp.Body)
                err := decoder.Decode(&m)
       -        if err != nil {
       -                return m, err
       -        }
       -
       -        return m, nil
       +        return m, err
        }
        
        func firstAnnValid() (*http.Response, error) {
       t@@ -141,7 +137,7 @@ func TestValidSecondHandshake(t *testing.T) {
                        t.Fatal(err)
                }
                decryptedEncode := base64.StdEncoding.EncodeToString(decrypted)
       -        sig, err := lib.SignMsgRsa([]byte(decryptedEncode), privkey)
       +        sig, _ := lib.SignMsgRsa([]byte(decryptedEncode), privkey)
                encodedSig := base64.StdEncoding.EncodeToString(sig)
        
                vals := ValidFirst
       t@@ -157,11 +153,10 @@ func TestValidSecondHandshake(t *testing.T) {
                if err != nil {
                        t.Fatal(err)
                }
       -        if m.Secret == lib.WelcomeMsg {
       -                t.Log("Server replied:", m.Secret)
       -        } else {
       +        if m.Secret != lib.WelcomeMsg {
                        t.Fatal(m.Secret)
                }
       +        t.Log("Server replied:", m.Secret)
        }
        
        func TestInvalidNodetypeFirst(t *testing.T) {