[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Fixed README.md and added cert and key options



commit edbe18d411cc53aab673927baf32a298d20c6972
Author: Hooman <hoomanm@xxxxxxxxxxxxx>
Date:   Tue Jul 11 13:33:00 2017 -0700

    Fixed README.md and added cert and key options
---
 broker/README.md | 17 ++++-------------
 broker/app.yaml  | 10 ----------
 broker/broker.go | 20 +++++++++++++++-----
 3 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/broker/README.md b/broker/README.md
index ab6af99..1efe9fc 100644
--- a/broker/README.md
+++ b/broker/README.md
@@ -22,18 +22,9 @@ The Broker expects:
 
 ### Running your own
 
-You can run your own Broker on either localhost or appengine.
-(Other CDNs will be supported soon.)
+You can run your own Broker on localhost, you'll need to pass a TLS
+certificate file using `--cert` option and the corresponding private key
+file using `--key` option.
 
-
-To run on localhost, run `dev_appserver.py` or equivalent from this
-directory. (on arch, I use the wrapper script `dev_appserver-go`)
-
-To run on appengine, you can spin up your own instance with an arbitrary
-name, and use `appcfg.py`.
-
-In both cases, you'll need to provide the URL of the custom broker
+You'll need to provide the URL of the custom broker
 to the client plugin using the `--url $URL` flag.
-
-See more detailed appengine instructions
-[here](https://cloud.google.com/appengine/docs/go/).
diff --git a/broker/app.yaml b/broker/app.yaml
deleted file mode 100644
index 14fcf0a..0000000
--- a/broker/app.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-# override this with appcfg.py -A $YOUR_APP_ID
-application: snowflake-reg
-version: 1
-runtime: go
-api_version: go1
-
-handlers:
-- url: /.*
-  script: _go_app
-  secure: always
diff --git a/broker/broker.go b/broker/broker.go
index 8550400..1932b81 100644
--- a/broker/broker.go
+++ b/broker/broker.go
@@ -15,6 +15,7 @@ import (
 	"time"
 	"sync"
 	"os"
+	"flag"
 )
 
 const (
@@ -228,18 +229,27 @@ func ipHandler(w http.ResponseWriter, r *http.Request) {
 	w.Write([]byte(remoteAddr))
 }
 
-func main() {
+var cert, cert_key string
+
+func init() {
+	flag.StringVar(&cert, "cert", "", "TLS certificate file")
+	flag.StringVar(&cert_key, "key", "", "TLS key file")
+
+	flag.Parse()
 
-	if len(os.Args) < 3 {
-		log.Println("Usage: broker cert cert_key")
+
+	if cert == "" || cert_key == "" {
+		log.Println("Missing options, exiting.")
+		fmt.Println("Usage:")
+		flag.PrintDefaults()
 		os.Exit(1)
 	}
 
-	cert := os.Args[1]
 	log.Println("Using cert file:", cert)
-	cert_key := os.Args[2]
 	log.Println("Using cert key file: ", cert_key)
+}
 
+func main() {
 
 	ctx := NewBrokerContext()
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits