tordam

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

commit 79e3828b0a407d302f13439ad960a5d146f58db9
parent f2d58e428131ad3255784e71d58f505392df2325
Author: parazyd <parazyd@dyne.org>
Date:   Tue,  9 Mar 2021 15:56:37 +0100

Some code linting.

Diffstat:
Mcmd/tor-dam/tor-dam.go | 12++++++++++--
Mtor_test.go | 6+++++-
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/cmd/tor-dam/tor-dam.go b/cmd/tor-dam/tor-dam.go @@ -119,7 +119,11 @@ func main() { // Spawn Tor daemon and let it settle tor, err := tordam.SpawnTor(tordam.Cfg.Listen, tordam.Cfg.Portmap, tordam.Cfg.Datadir) - defer tor.Process.Kill() + defer func() { + if err := tor.Process.Kill(); err != nil { + log.Println(err) + } + }() if err != nil { log.Fatal(err) } @@ -153,7 +157,11 @@ func main() { // "ann" is the JSON-RPC endpoint for peer discovery/announcement "ann": handler.NewService(tordam.Ann{}), } - go server.Loop(l, server.NewStatic(assigner), nil) + go func() { + if err := server.Loop(l, server.NewStatic(assigner), nil); err != nil { + log.Println(err) + } + }() log.Println("Started JSON-RPC server on", tordam.Cfg.Listen.String()) // If decided to not announce to anyone diff --git a/tor_test.go b/tor_test.go @@ -28,7 +28,11 @@ func TestSpawnTor(t *testing.T) { t.Fatal(err) } tor, err := SpawnTor(l, []string{"1234:1234"}, "tor_test") - defer tor.Process.Kill() + defer func() { + if err := tor.Process.Kill(); err != nil { + t.Fatal(err) + } + }() defer os.RemoveAll("tor_test") if err != nil { t.Fatal(err)