From 6ff74cfcab9c8b445abc46bb783965341f21f083 Mon Sep 17 00:00:00 2001 From: aviau Date: Mon, 4 Jul 2016 10:51:22 +0000 Subject: [PATCH] build, cmd/stdiscosrv, cmd/strelaysrv: Rename binaries to add "st" prefix GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3371 --- .gitignore | 4 +-- build.go | 36 +++++++++---------- cmd/{discosrv => stdiscosrv}/LICENSE | 0 cmd/{discosrv => stdiscosrv}/README.md | 20 +++++------ cmd/{discosrv => stdiscosrv}/clean.go | 0 cmd/{discosrv => stdiscosrv}/db.go | 0 cmd/{discosrv => stdiscosrv}/main.go | 4 +-- cmd/{discosrv => stdiscosrv}/psql.go | 0 cmd/{discosrv => stdiscosrv}/ql.go | 0 cmd/{discosrv => stdiscosrv}/querysrv.go | 0 cmd/{discosrv => stdiscosrv}/stats.go | 0 cmd/{relaysrv => strelaysrv}/LICENSE | 0 cmd/{relaysrv => strelaysrv}/README.md | 30 ++++++++-------- .../etc/linux-systemd/strelaysrv.service} | 8 ++--- cmd/{relaysrv => strelaysrv}/listener.go | 0 cmd/{relaysrv => strelaysrv}/main.go | 4 +-- cmd/{relaysrv => strelaysrv}/pool.go | 0 cmd/{relaysrv => strelaysrv}/session.go | 0 cmd/{relaysrv => strelaysrv}/status.go | 0 cmd/{relaysrv => strelaysrv}/testutil/main.go | 0 cmd/{relaysrv => strelaysrv}/utils.go | 0 21 files changed, 53 insertions(+), 53 deletions(-) rename cmd/{discosrv => stdiscosrv}/LICENSE (100%) rename cmd/{discosrv => stdiscosrv}/README.md (60%) rename cmd/{discosrv => stdiscosrv}/clean.go (100%) rename cmd/{discosrv => stdiscosrv}/db.go (100%) rename cmd/{discosrv => stdiscosrv}/main.go (92%) rename cmd/{discosrv => stdiscosrv}/psql.go (100%) rename cmd/{discosrv => stdiscosrv}/ql.go (100%) rename cmd/{discosrv => stdiscosrv}/querysrv.go (100%) rename cmd/{discosrv => stdiscosrv}/stats.go (100%) rename cmd/{relaysrv => strelaysrv}/LICENSE (100%) rename cmd/{relaysrv => strelaysrv}/README.md (65%) rename cmd/{relaysrv/etc/linux-systemd/syncthing-relaysrv.service => strelaysrv/etc/linux-systemd/strelaysrv.service} (60%) rename cmd/{relaysrv => strelaysrv}/listener.go (100%) rename cmd/{relaysrv => strelaysrv}/main.go (96%) rename cmd/{relaysrv => strelaysrv}/pool.go (100%) rename cmd/{relaysrv => strelaysrv}/session.go (100%) rename cmd/{relaysrv => strelaysrv}/status.go (100%) rename cmd/{relaysrv => strelaysrv}/testutil/main.go (100%) rename cmd/{relaysrv => strelaysrv}/utils.go (100%) diff --git a/.gitignore b/.gitignore index 172bf4e00..5a5fae76d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /syncthing -/discosrv +/stdiscosrv syncthing.exe -discosrv.exe +stdiscosrv.exe *.tar.gz *.zip *.asc diff --git a/build.go b/build.go index 5e390c0ad..c1b3a13c5 100644 --- a/build.go +++ b/build.go @@ -96,39 +96,39 @@ var targets = map[string]target{ {src: "etc/linux-systemd/user/syncthing.service", dst: "deb/usr/lib/systemd/user/syncthing.service", perm: 0644}, }, }, - "discosrv": { - name: "discosrv", - buildPkg: "./cmd/discosrv", - binaryName: "discosrv", // .exe will be added automatically for Windows builds + "stdiscosrv": { + name: "stdiscosrv", + buildPkg: "./cmd/stdiscosrv", + binaryName: "stdiscosrv", // .exe will be added automatically for Windows builds archiveFiles: []archiveFile{ {src: "{{binary}}", dst: "{{binary}}", perm: 0755}, - {src: "cmd/discosrv/README.md", dst: "README.txt", perm: 0644}, - {src: "cmd/discosrv/LICENSE", dst: "LICENSE.txt", perm: 0644}, + {src: "cmd/stdiscosrv/README.md", dst: "README.txt", perm: 0644}, + {src: "cmd/stdiscosrv/LICENSE", dst: "LICENSE.txt", perm: 0644}, {src: "AUTHORS", dst: "AUTHORS.txt", perm: 0644}, }, debianFiles: []archiveFile{ {src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755}, - {src: "cmd/discosrv/README.md", dst: "deb/usr/share/doc/discosrv/README.txt", perm: 0644}, - {src: "cmd/discosrv/LICENSE", dst: "deb/usr/share/doc/discosrv/LICENSE.txt", perm: 0644}, - {src: "AUTHORS", dst: "deb/usr/share/doc/discosrv/AUTHORS.txt", perm: 0644}, + {src: "cmd/stdiscosrv/README.md", dst: "deb/usr/share/doc/stdiscosrv/README.txt", perm: 0644}, + {src: "cmd/stdiscosrv/LICENSE", dst: "deb/usr/share/doc/stdiscosrv/LICENSE.txt", perm: 0644}, + {src: "AUTHORS", dst: "deb/usr/share/doc/stdiscosrv/AUTHORS.txt", perm: 0644}, }, tags: []string{"purego"}, }, - "relaysrv": { - name: "relaysrv", - buildPkg: "./cmd/relaysrv", - binaryName: "relaysrv", // .exe will be added automatically for Windows builds + "strelaysrv": { + name: "strelaysrv", + buildPkg: "./cmd/strelaysrv", + binaryName: "strelaysrv", // .exe will be added automatically for Windows builds archiveFiles: []archiveFile{ {src: "{{binary}}", dst: "{{binary}}", perm: 0755}, - {src: "cmd/relaysrv/README.md", dst: "README.txt", perm: 0644}, - {src: "cmd/relaysrv/LICENSE", dst: "LICENSE.txt", perm: 0644}, + {src: "cmd/strelaysrv/README.md", dst: "README.txt", perm: 0644}, + {src: "cmd/strelaysrv/LICENSE", dst: "LICENSE.txt", perm: 0644}, {src: "AUTHORS", dst: "AUTHORS.txt", perm: 0644}, }, debianFiles: []archiveFile{ {src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755}, - {src: "cmd/relaysrv/README.md", dst: "deb/usr/share/doc/relaysrv/README.txt", perm: 0644}, - {src: "cmd/relaysrv/LICENSE", dst: "deb/usr/share/doc/relaysrv/LICENSE.txt", perm: 0644}, - {src: "AUTHORS", dst: "deb/usr/share/doc/relaysrv/AUTHORS.txt", perm: 0644}, + {src: "cmd/strelaysrv/README.md", dst: "deb/usr/share/doc/strelaysrv/README.txt", perm: 0644}, + {src: "cmd/strelaysrv/LICENSE", dst: "deb/usr/share/doc/strelaysrv/LICENSE.txt", perm: 0644}, + {src: "AUTHORS", dst: "deb/usr/share/doc/strelaysrv/AUTHORS.txt", perm: 0644}, }, }, } diff --git a/cmd/discosrv/LICENSE b/cmd/stdiscosrv/LICENSE similarity index 100% rename from cmd/discosrv/LICENSE rename to cmd/stdiscosrv/LICENSE diff --git a/cmd/discosrv/README.md b/cmd/stdiscosrv/README.md similarity index 60% rename from cmd/discosrv/README.md rename to cmd/stdiscosrv/README.md index 8269c607c..f224eca7f 100644 --- a/cmd/discosrv/README.md +++ b/cmd/stdiscosrv/README.md @@ -1,12 +1,12 @@ -discosrv -======== +stdiscosrv +========== -[![Latest Build](http://img.shields.io/jenkins/s/http/build.syncthing.net/discosrv.svg?style=flat-square)](http://build.syncthing.net/job/discosrv/lastBuild/) +[![Latest Build](http://img.shields.io/jenkins/s/http/build.syncthing.net/stdiscosrv.svg?style=flat-square)](http://build.syncthing.net/job/stdiscosrv/lastBuild/) This is the global discovery server for the `syncthing` project. -To get it, run `go get github.com/syncthing/discosrv` or download the -[latest build](http://build.syncthing.net/job/discosrv/lastSuccessfulBuild/artifact/) +To get it, run `go get github.com/syncthing/stdiscosrv` or download the +[latest build](http://build.syncthing.net/job/stdiscosrv/lastSuccessfulBuild/artifact/) from the build server. Usage @@ -19,15 +19,15 @@ By default it will use in-memory `ql` backend. If you wish to persist the information on disk between restarts in `ql`, specify a file DSN: ```bash -$ discosrv -db-dsn="file:///var/run/discosrv.db" +$ stdiscosrv -db-dsn="file:///var/run/stdiscosrv.db" ``` For `postgres`, you will need to create a database and a user with permissions -to create tables in it, then start the discosrv as follows: +to create tables in it, then start the stdiscosrv as follows: ```bash -$ export DISCOSRV_DB_DSN="postgres://user:password@localhost/databasename" -$ discosrv -db-backend="postgres" +$ export STDISCOSRV_DB_DSN="postgres://user:password@localhost/databasename" +$ stdiscosrv -db-backend="postgres" ``` You can pass the DSN as command line option, but the value what you pass in will @@ -37,4 +37,4 @@ to other users. In all cases, the appropriate tables and indexes will be created at first startup. If it doesn't exit with an error, you're fine. -See `discosrv -help` for other options. +See `stdiscosrv -help` for other options. diff --git a/cmd/discosrv/clean.go b/cmd/stdiscosrv/clean.go similarity index 100% rename from cmd/discosrv/clean.go rename to cmd/stdiscosrv/clean.go diff --git a/cmd/discosrv/db.go b/cmd/stdiscosrv/db.go similarity index 100% rename from cmd/discosrv/db.go rename to cmd/stdiscosrv/db.go diff --git a/cmd/discosrv/main.go b/cmd/stdiscosrv/main.go similarity index 92% rename from cmd/discosrv/main.go rename to cmd/stdiscosrv/main.go index 16f0623e7..ff5af59f1 100644 --- a/cmd/discosrv/main.go +++ b/cmd/stdiscosrv/main.go @@ -38,7 +38,7 @@ func init() { BuildDate = time.Unix(int64(stamp), 0) date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST") - LongVersion = fmt.Sprintf(`discosrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date) + LongVersion = fmt.Sprintf(`stdiscosrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date) } var ( @@ -48,7 +48,7 @@ var ( globalStats stats statsFile string backend = "ql" - dsn = getEnvDefault("DISCOSRV_DB_DSN", "memory://discosrv") + dsn = getEnvDefault("STDISCOSRV_DB_DSN", "memory://stdiscosrv") certFile = "cert.pem" keyFile = "key.pem" debug = false diff --git a/cmd/discosrv/psql.go b/cmd/stdiscosrv/psql.go similarity index 100% rename from cmd/discosrv/psql.go rename to cmd/stdiscosrv/psql.go diff --git a/cmd/discosrv/ql.go b/cmd/stdiscosrv/ql.go similarity index 100% rename from cmd/discosrv/ql.go rename to cmd/stdiscosrv/ql.go diff --git a/cmd/discosrv/querysrv.go b/cmd/stdiscosrv/querysrv.go similarity index 100% rename from cmd/discosrv/querysrv.go rename to cmd/stdiscosrv/querysrv.go diff --git a/cmd/discosrv/stats.go b/cmd/stdiscosrv/stats.go similarity index 100% rename from cmd/discosrv/stats.go rename to cmd/stdiscosrv/stats.go diff --git a/cmd/relaysrv/LICENSE b/cmd/strelaysrv/LICENSE similarity index 100% rename from cmd/relaysrv/LICENSE rename to cmd/strelaysrv/LICENSE diff --git a/cmd/relaysrv/README.md b/cmd/strelaysrv/README.md similarity index 65% rename from cmd/relaysrv/README.md rename to cmd/strelaysrv/README.md index f4876df91..bcb119a91 100644 --- a/cmd/relaysrv/README.md +++ b/cmd/strelaysrv/README.md @@ -1,12 +1,12 @@ -relaysrv -======== +strelaysrv +========== -[![Latest Build](http://img.shields.io/jenkins/s/http/build.syncthing.net/relaysrv.svg?style=flat-square)](http://build.syncthing.net/job/relaysrv/lastBuild/) +[![Latest Build](http://img.shields.io/jenkins/s/http/build.syncthing.net/strelaysrv.svg?style=flat-square)](http://build.syncthing.net/job/strelaysrv/lastBuild/) This is the relay server for the `syncthing` project. -To get it, run `go get github.com/syncthing/relaysrv` or download the -[latest build](http://build.syncthing.net/job/relaysrv/lastSuccessfulBuild/artifact/) +To get it, run `go get github.com/syncthing/strelaysrv` or download the +[latest build](http://build.syncthing.net/job/strelaysrv/lastSuccessfulBuild/artifact/) from the build server. :exclamation:Warnings:exclamation: - Read or regret @@ -16,13 +16,13 @@ By default, all relay servers will join the default public relay pool, which mea If you wish to disable this behaviour, please specify `-pools=""` argument. -Please note that `relaysrv` is only usable by `syncthing` **version v0.12 and onwards**. +Please note that `strelaysrv` is only usable by `syncthing` **version v0.12 and onwards**. -To run `relaysrv` you need to have port 22067 available to the internet, which means you might need to allow it through your firewall if you **have a public IP, or setup a port-forwarding** (22067 to 22067) if you are behind a router. +To run `strelaysrv` you need to have port 22067 available to the internet, which means you might need to allow it through your firewall if you **have a public IP, or setup a port-forwarding** (22067 to 22067) if you are behind a router. -Furthermore, **by default relaysrv will also expose a /status HTTP endpoint on port 22070**, which is used by the pool servers to peek at metrics of the relaysrv, such as what are the current transfer rates, how many clients are connected, etc, etc. If you wish this information to be available, similarlly you might want to allow it through your firewall, or port-forward it (22070 to 22070) on your NAT device. +Furthermore, **by default strelaysrv will also expose a /status HTTP endpoint on port 22070**, which is used by the pool servers to peek at metrics of the strelaysrv, such as what are the current transfer rates, how many clients are connected, etc, etc. If you wish this information to be available, similarlly you might want to allow it through your firewall, or port-forward it (22070 to 22070) on your NAT device. -This is **not mandatory** for the relaysrv to function, and is used only to gather metrics and present them in the overview page of the pool server, displaying stats about the specific relay. +This is **not mandatory** for the strelaysrv to function, and is used only to gather metrics and present them in the overview page of the pool server, displaying stats about the specific relay. At the point of writing the endpoint output looks as follows: @@ -62,31 +62,31 @@ At the point of writing the endpoint output looks as follows: } ``` -If you wish to disable the /status endpoint, provide `-status-srv=""` as one of the arguments when starting the relaysrv. +If you wish to disable the /status endpoint, provide `-status-srv=""` as one of the arguments when starting the strelaysrv. Running for public use ---- Make sure you have a public IP with port 22067 open, or make sure you have port-forwarding (22067 to 22067) if you are behind a router. -Run the `relaysrv` with no arguments (or `-debug` if you want more output), and that should be enough for the server to join the public relay pool. +Run the `strelaysrv` with no arguments (or `-debug` if you want more output), and that should be enough for the server to join the public relay pool. You should see a message saying: ``` 2015/09/21 22:45:46 pool.go:60: Joined https://relays.syncthing.net/endpoint rejoining in 48m0s ``` -See `relaysrv -help` for other options, such as rate limits, timeout intervals, etc. +See `strelaysrv -help` for other options, such as rate limits, timeout intervals, etc. Running for private use ----- -Once you've started the `relaysrv`, it will generate a key pair and print an URI: +Once you've started the `strelaysrv`, it will generate a key pair and print an URI: ```bash relay://:22067/?id=EZQOIDM-6DDD4ZI-DJ65NSM-4OQWRAT-EIKSMJO-OZ552BO-WQZEGYY-STS5RQM&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070 ``` This URI contains partial address of the relay server, as well as it's options which in the future may be taken into account when choosing the best suitable relay out of multiple available. -Because `-listen` option was not used, the `relaysrv` does not know it's external IP, therefore you should replace the host part of the URI with your public IP address on which the `relaysrv` will be available: +Because `-listen` option was not used, the `strelaysrv` does not know it's external IP, therefore you should replace the host part of the URI with your public IP address on which the `strelaysrv` will be available: ```bash relay://123.123.123.123:22067/?id=EZQOIDM-6DDD4ZI-DJ65NSM-4OQWRAT-EIKSMJO-OZ552BO-WQZEGYY-STS5RQM&pingInterval=1m0s&networkTimeout=2m0s&sessionLimitBps=0&globalLimitBps=0&statusAddr=:22070 @@ -100,7 +100,7 @@ relay://123.123.123.123:22067 This URI can then be used in `syncthing` as one of the relay servers. -See `relaysrv -help` for other options, such as rate limits, timeout intervals, etc. +See `strelaysrv -help` for other options, such as rate limits, timeout intervals, etc. Other items available in this repo ---- diff --git a/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service b/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service similarity index 60% rename from cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service rename to cmd/strelaysrv/etc/linux-systemd/strelaysrv.service index b9d3173cf..90907757f 100644 --- a/cmd/relaysrv/etc/linux-systemd/syncthing-relaysrv.service +++ b/cmd/strelaysrv/etc/linux-systemd/strelaysrv.service @@ -3,10 +3,10 @@ Description=Syncthing relay server After=network.target [Service] -User=syncthing-relaysrv -Group=syncthing-relaysrv -ExecStart=/usr/bin/relaysrv -WorkingDirectory=/var/lib/syncthing-relaysrv +User=strelaysrv +Group=strelaysrv +ExecStart=/usr/bin/strelaysrv +WorkingDirectory=/var/lib/strelaysrv PrivateTmp=true ProtectSystem=full diff --git a/cmd/relaysrv/listener.go b/cmd/strelaysrv/listener.go similarity index 100% rename from cmd/relaysrv/listener.go rename to cmd/strelaysrv/listener.go diff --git a/cmd/relaysrv/main.go b/cmd/strelaysrv/main.go similarity index 96% rename from cmd/relaysrv/main.go rename to cmd/strelaysrv/main.go index 77b63abe3..272d1c3dd 100644 --- a/cmd/relaysrv/main.go +++ b/cmd/strelaysrv/main.go @@ -42,7 +42,7 @@ func init() { BuildDate = time.Unix(int64(stamp), 0) date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST") - LongVersion = fmt.Sprintf(`relaysrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date) + LongVersion = fmt.Sprintf(`strelaysrv %s (%s %s-%s) %s@%s %s`, Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date) } var ( @@ -121,7 +121,7 @@ func main() { cert, err := tls.LoadX509KeyPair(certFile, keyFile) if err != nil { log.Println("Failed to load keypair. Generating one, this might take a while...") - cert, err = tlsutil.NewCertificate(certFile, keyFile, "relaysrv", 3072) + cert, err = tlsutil.NewCertificate(certFile, keyFile, "strelaysrv", 3072) if err != nil { log.Fatalln("Failed to generate X509 key pair:", err) } diff --git a/cmd/relaysrv/pool.go b/cmd/strelaysrv/pool.go similarity index 100% rename from cmd/relaysrv/pool.go rename to cmd/strelaysrv/pool.go diff --git a/cmd/relaysrv/session.go b/cmd/strelaysrv/session.go similarity index 100% rename from cmd/relaysrv/session.go rename to cmd/strelaysrv/session.go diff --git a/cmd/relaysrv/status.go b/cmd/strelaysrv/status.go similarity index 100% rename from cmd/relaysrv/status.go rename to cmd/strelaysrv/status.go diff --git a/cmd/relaysrv/testutil/main.go b/cmd/strelaysrv/testutil/main.go similarity index 100% rename from cmd/relaysrv/testutil/main.go rename to cmd/strelaysrv/testutil/main.go diff --git a/cmd/relaysrv/utils.go b/cmd/strelaysrv/utils.go similarity index 100% rename from cmd/relaysrv/utils.go rename to cmd/strelaysrv/utils.go