From 4676dec52aec8f67f6d1c5a40365fe54103c135d Mon Sep 17 00:00:00 2001 From: James Crayne Date: Fri, 18 Oct 2019 05:31:00 +0000 Subject: implement --noavahi --- dht/examples/dhtd.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs index 2f1e5831..6bbb3388 100644 --- a/dht/examples/dhtd.hs +++ b/dht/examples/dhtd.hs @@ -1121,6 +1121,7 @@ data Options = Options -- [ 2 ] Log all stanzas, even pings. , verbosity :: Int , verboseTags :: [DebugTag] + , advertiseOnAvahi :: Bool } deriving (Eq,Show) @@ -1135,16 +1136,18 @@ sensibleDefaults = Options , dhtkey = Nothing , verbosity = 2 , verboseTags = [XUnexpected, XUnused] + , advertiseOnAvahi = True } data ShowHelp = ShowHelp deriving (Eq,Show) usage ShowHelp - = let { cs = [ ([["--help"]] ,["display this help"]) + = let { cs = [([["--help"]] ,["Display this help"]) , ([["--dhtkey ",dhtkey] - ,["--dht-key ",dhtkey]],["use ",dhtkey," as the dht key"]) + ,["--dht-key ",dhtkey]],["Use ",dhtkey," as the dht key"]) , ([["-4"]] ,["Use IPv4 only"]) + , ([["--noavahi"]] ,["Disable avahi advertising on LAN"]) , ([["-v ",tags]] ,["Enable or disable specified DebugTags.\n DebugTags = ", listDebugTags]) ] ; dhtkey ="" ; @@ -1164,6 +1167,7 @@ usage ShowHelp parseArgs :: [String] -> Options -> Either ShowHelp Options parseArgs [] opts = Right opts parseArgs ("--help":args) opts = Left ShowHelp +parseArgs ("--noavahi":args) opts = parseArgs args opts { advertiseOnAvahi = False } parseArgs ("--dhtkey":k:args) opts = parseArgs args opts { dhtkey = decodeSecret $ B.pack k } parseArgs ("--dht-key":k:args) opts = parseArgs args opts @@ -1386,7 +1390,7 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of (dhtkey opts) (\_ _ -> return ()) -- TODO: TCP relay send -- addrTox <- getBindAddress toxport (ip6tox opts) - (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox True + (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox (advertiseOnAvahi opts) toxSearches <- atomically $ newTVar Map.empty -- cgit v1.2.3