commit 31e003e1deb00e8611d652d77c12b763f8ba96a3
parent 7a8f7cbade62be63c5ff6eaaa36a258f4c12c25f
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:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmd/dam-client/main.go b/cmd/dam-client/main.go
@@ -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 {
@@ -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()
diff --git a/pkg/damlib/config.go b/pkg/damlib/config.go
@@ -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