From 5c8a28d7178253bb946018abbdbf576bffbb41b2 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sun, 18 Oct 2015 16:57:13 +0100 Subject: [PATCH] Add ability to advertise provider --- cmd/relaysrv/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/relaysrv/main.go b/cmd/relaysrv/main.go index a48d90975..4310c366d 100644 --- a/cmd/relaysrv/main.go +++ b/cmd/relaysrv/main.go @@ -38,6 +38,7 @@ var ( statusAddr string poolAddrs string + providedBy string defaultPoolAddrs string = "https://relays.syncthing.net/endpoint" ) @@ -56,6 +57,7 @@ func main() { flag.BoolVar(&debug, "debug", debug, "Enable debug output") flag.StringVar(&statusAddr, "status-srv", ":22070", "Listen address for status service (blank to disable)") flag.StringVar(&poolAddrs, "pools", defaultPoolAddrs, "Comma separated list of relay pool addresses to join") + flag.StringVar(&providedBy, "provided-by", "", "An optional description about who provides the relay") flag.Parse() @@ -114,7 +116,7 @@ func main() { go statusService(statusAddr) } - uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s", extAddress, id, pingInterval, networkTimeout, sessionLimitBps, globalLimitBps, statusAddr)) + uri, err := url.Parse(fmt.Sprintf("relay://%s/?id=%s&pingInterval=%s&networkTimeout=%s&sessionLimitBps=%d&globalLimitBps=%d&statusAddr=%s&providedBy=%s", extAddress, id, pingInterval, networkTimeout, sessionLimitBps, globalLimitBps, statusAddr, providedBy)) if err != nil { log.Fatalln("Failed to construct URI", err) }