TBR

v: renaming the v directory to go

Change-Id: I4fd9f6ee2895d8034c23b65927eb118980b3c17a
diff --git a/runtimes/google/daemon/proxyd/main.go b/runtimes/google/daemon/proxyd/main.go
new file mode 100644
index 0000000..cd0be22
--- /dev/null
+++ b/runtimes/google/daemon/proxyd/main.go
@@ -0,0 +1,52 @@
+// proxyd is a daemon that listens for connections from veyron services
+// (typically behind NATs) and proxies these services to the outside world.
+package main
+
+import (
+	"flag"
+	"net/http"
+	_ "net/http/pprof"
+	"time"
+
+	"veyron/runtimes/google/ipc"
+	"veyron/runtimes/google/ipc/stream/proxy"
+	"veyron2/naming"
+	"veyron2/rt"
+	"veyron2/vlog"
+)
+
+func main() {
+	var (
+		address  = flag.String("address", ":0", "Network address the proxy listens on")
+		protocol = flag.String("protocol", "tcp", "Network type the proxy listens on")
+		httpAddr = flag.String("http", ":14142", "Network address on which the HTTP debug server runs")
+		name     = flag.String("name", "", "Name to mount the proxy as")
+	)
+
+	r := rt.Init()
+	defer r.Shutdown()
+
+	rid, err := naming.NewRoutingID()
+	if err != nil {
+		vlog.Fatal(err)
+	}
+
+	proxy, err := proxy.New(rid, nil, *protocol, *address)
+	if err != nil {
+		vlog.Fatal(err)
+	}
+	defer proxy.Shutdown()
+
+	if len(*name) > 0 {
+		publisher := ipc.InternalNewPublisher(r.MountTable(), time.Minute)
+		defer publisher.WaitForStop()
+		defer publisher.Stop()
+		publisher.AddServer(naming.JoinAddressName(proxy.Endpoint().String(), ""))
+		publisher.AddName(*name)
+	}
+
+	http.Handle("/", proxy)
+	if err = http.ListenAndServe(*httpAddr, nil); err != nil {
+		vlog.Fatal(err)
+	}
+}