tordam

A library for peer discovery inside the Tor network
git clone https://git.parazyd.org/tordam
Log | Files | Refs | README | LICENSE

commit a21e7672224c07101f34819e76a97d9944764d09
parent c0a9715772f824767c5ae8803bfdb0a1709a93f6
Author: parazyd <parazyd@dyne.org>
Date:   Sat,  9 Dec 2017 15:54:25 +0100

Announce to known directories concurrently.

Diffstat:
Mcmd/dam-client/main.go | 19++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go @@ -10,6 +10,7 @@ import ( "log" "os" "os/exec" + "sync" "time" "github.com/parazyd/tor-dam/pkg/lib" @@ -166,13 +167,21 @@ func main() { var ann = 0 // Track of how many successful authentications dirs := []string{"qvhgzxjkdchj2jl5.onion", "localhost"} + + var wg sync.WaitGroup for _, i := range dirs { - valid, err := announce(i, nodevals, key) - lib.CheckError(err) - if valid { - ann++ - } + wg.Add(1) + go func(x string) { + valid, err := announce(x, nodevals, key) + lib.CheckError(err) + if valid { + ann++ + } + wg.Done() + }(i) } + wg.Wait() + if ann > 0 { log.Printf("Successfully authenticated with %d nodes.\n", ann) } else {