commit 36debdfdd24e978fc323ec352852fc4af0bc4ae5 Merge: 3e3e4b8 827972e Author: David Fifield david@bamsoftware.com Date: Wed Aug 2 19:34:00 2017 -0700
Merge branch 'standalone-broker'
appengine/README | 27 ++++++++++ {broker => appengine}/app.yaml | 3 -- appengine/reflect.go | 108 ++++++++++++++++++++++++++++++++++++++++ broker/README.md | 37 ++++++++------ broker/broker.go | 56 ++++++++++++++++++++- broker/metrics.go | 2 +- broker/snowflake-broker_test.go | 2 +- broker/snowflake-heap.go | 2 +- 8 files changed, 215 insertions(+), 22 deletions(-)
diff --cc broker/broker.go index a56f40b,a41265b..6cb08d9 --- a/broker/broker.go +++ b/broker/broker.go @@@ -217,9 -222,27 +222,29 @@@ func robotsTxtHandler(w http.ResponseWr w.Write([]byte("User-agent: *\nDisallow:\n")) }
- func init() { + func ipHandler(w http.ResponseWriter, r *http.Request) { + remoteAddr := r.RemoteAddr + if net.ParseIP(remoteAddr).To4() == nil { + remoteAddr = "[" + remoteAddr + "]" + } + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.Write([]byte(remoteAddr)) + } + + func main() { + var acmeEmail string + var acmeHostnamesCommas string + var addr string + var disableTLS bool + + flag.StringVar(&acmeEmail, "acme-email", "", "optional contact email for Let's Encrypt notifications") + flag.StringVar(&acmeHostnamesCommas, "acme-hostnames", "", "comma-separated hostnames for TLS certificate") + flag.StringVar(&addr, "addr", ":443", "address to listen on") + flag.BoolVar(&disableTLS, "disable-tls", false, "don't use HTTPS") + flag.Parse() + + log.SetFlags(log.LstdFlags | log.LUTC) + ctx := NewBrokerContext()
go ctx.Broker()
tor-commits@lists.torproject.org