tAdd a flag in dam-client for a dynamic portmap. - 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 31e003e1deb00e8611d652d77c12b763f8ba96a3
 (DIR) parent 7a8f7cbade62be63c5ff6eaaa36a258f4c12c25f
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Fri,  4 Oct 2019 15:34:39 +0200
       
       Add a flag in dam-client for a dynamic portmap.
       
       Diffstat:
         M cmd/dam-client/main.go              |       4 ++++
         M pkg/damlib/config.go                |       2 +-
       
       2 files changed, 5 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go
       t@@ -51,6 +51,7 @@ var (
                gen         = flag.Bool("gen", false, "Only (re)generate keypairs and exit cleanly.")
                annint      = flag.Int("ai", 5, "Announce interval (in minutes)")
                remoteentry = flag.String("remoteentry", "https://dam.decodeproject.eu/dirs.txt", "Remote list of entrypoints. (comma-separated)")
       +        portmap     = flag.String("portmap", "13010:13010,13011:13011,5000:5000", "Map of ports forwarded to/from Tor.")
        )
        
        func clientInit(gen bool) error {
       t@@ -249,6 +250,9 @@ func main() {
                        lib.CheckError(err)
                }
        
       +        // Map it to the flag
       +        lib.TorPortMap = "80:49371," + *portmap
       +
                log.Println("Starting up the hidden service.")
                cmd := exec.Command("damhs.py", "-k", lib.PrivKeyPath, "-p", lib.TorPortMap)
                defer cmd.Process.Kill()
 (DIR) diff --git a/pkg/damlib/config.go b/pkg/damlib/config.go
       t@@ -45,7 +45,7 @@ const ProxyAddr = "127.0.0.1:9050"
        
        // TorPortMap is a comma-separated string holding the mapping of ports
        // to be opened by the Tor Hidden Service. Format is "remote:local".
       -const TorPortMap = "80:49371,13010:13010,13011:13011,5000:5000"
       +var TorPortMap = "80:49371,13010:13010,13011:13011,5000:5000"
        
        // DirPort is the port where dam-dir will be listening.
        const DirPort = 49371