runtime/protocols: Rename xwebsocket to websocket and move tcputil and
websocket from runtime/internal/lib to runtime/protocols/lib.
Since framer is in runtime/protocols/lib, it seems that it should be
the natural place for the implementations for the other protocols.
Change-Id: I6c7159ce4a3a611a87fe310304c5dec37f9981eb
diff --git a/runtime/factories/android/android.go b/runtime/factories/android/android.go
index 0bf819c..35732ea 100644
--- a/runtime/factories/android/android.go
+++ b/runtime/factories/android/android.go
@@ -30,9 +30,9 @@
"v.io/x/ref/runtime/internal"
"v.io/x/ref/runtime/internal/lib/appcycle"
"v.io/x/ref/runtime/internal/lib/roaming"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
inamespace "v.io/x/ref/runtime/internal/naming/namespace"
"v.io/x/ref/runtime/internal/rt"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/tcp"
_ "v.io/x/ref/runtime/protocols/ws"
_ "v.io/x/ref/runtime/protocols/wsh"
@@ -50,7 +50,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WSH{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WSH{})
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Runtime, flags.Listen)
}
diff --git a/runtime/factories/chrome/chrome.go b/runtime/factories/chrome/chrome.go
index ed49651..aca02e7 100644
--- a/runtime/factories/chrome/chrome.go
+++ b/runtime/factories/chrome/chrome.go
@@ -16,8 +16,8 @@
"v.io/x/ref/lib/flags"
"v.io/x/ref/runtime/internal"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
grt "v.io/x/ref/runtime/internal/rt"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/ws"
_ "v.io/x/ref/runtime/protocols/wsh_nacl"
)
@@ -26,7 +26,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WS{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WS{})
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Runtime)
}
diff --git a/runtime/factories/fake/fake.go b/runtime/factories/fake/fake.go
index 89ec1d7..ef4b914 100644
--- a/runtime/factories/fake/fake.go
+++ b/runtime/factories/fake/fake.go
@@ -16,7 +16,7 @@
"v.io/v23/flow"
"v.io/x/ref/runtime/internal"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/local"
_ "v.io/x/ref/runtime/protocols/tcp"
_ "v.io/x/ref/runtime/protocols/ws"
@@ -34,7 +34,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WSH{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WSH{})
}
func Init(ctx *context.T) (v23.Runtime, *context.T, v23.Shutdown, error) {
diff --git a/runtime/factories/gce/gce.go b/runtime/factories/gce/gce.go
index b230fc6..a78018f 100644
--- a/runtime/factories/gce/gce.go
+++ b/runtime/factories/gce/gce.go
@@ -23,8 +23,8 @@
"v.io/x/ref/runtime/internal"
"v.io/x/ref/runtime/internal/gce"
"v.io/x/ref/runtime/internal/lib/appcycle"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
grt "v.io/x/ref/runtime/internal/rt"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/tcp"
_ "v.io/x/ref/runtime/protocols/ws"
_ "v.io/x/ref/runtime/protocols/wsh"
@@ -34,7 +34,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WSH{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WSH{})
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Runtime, flags.Listen)
}
diff --git a/runtime/factories/generic/generic.go b/runtime/factories/generic/generic.go
index ac3a0d6..d9f1951 100644
--- a/runtime/factories/generic/generic.go
+++ b/runtime/factories/generic/generic.go
@@ -18,8 +18,8 @@
"v.io/x/ref/lib/flags"
"v.io/x/ref/runtime/internal"
"v.io/x/ref/runtime/internal/lib/appcycle"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
grt "v.io/x/ref/runtime/internal/rt"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/tcp"
_ "v.io/x/ref/runtime/protocols/ws"
_ "v.io/x/ref/runtime/protocols/wsh"
@@ -29,7 +29,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WSH{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WSH{})
flags.SetDefaultHostPort(":0")
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Runtime, flags.Listen)
}
diff --git a/runtime/factories/roaming/roaming.go b/runtime/factories/roaming/roaming.go
index e8e6ea3..32b596d 100644
--- a/runtime/factories/roaming/roaming.go
+++ b/runtime/factories/roaming/roaming.go
@@ -29,8 +29,8 @@
"v.io/x/ref/runtime/internal"
"v.io/x/ref/runtime/internal/lib/appcycle"
"v.io/x/ref/runtime/internal/lib/roaming"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
"v.io/x/ref/runtime/internal/rt"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
_ "v.io/x/ref/runtime/protocols/tcp"
_ "v.io/x/ref/runtime/protocols/ws"
_ "v.io/x/ref/runtime/protocols/wsh"
@@ -41,7 +41,7 @@
func init() {
v23.RegisterRuntimeFactory(Init)
- flow.RegisterUnknownProtocol("wsh", xwebsocket.WSH{})
+ flow.RegisterUnknownProtocol("wsh", websocket.WSH{})
commonFlags = flags.CreateAndRegister(flag.CommandLine, flags.Runtime, flags.Listen)
}
diff --git a/runtime/internal/rpc/test/client_test.go b/runtime/internal/rpc/test/client_test.go
index 27ec252..331aff6 100644
--- a/runtime/internal/rpc/test/client_test.go
+++ b/runtime/internal/rpc/test/client_test.go
@@ -32,10 +32,10 @@
"v.io/x/ref/lib/signals"
_ "v.io/x/ref/runtime/factories/generic"
"v.io/x/ref/runtime/internal/flow/conn"
- "v.io/x/ref/runtime/internal/lib/tcputil"
inaming "v.io/x/ref/runtime/internal/naming"
irpc "v.io/x/ref/runtime/internal/rpc"
"v.io/x/ref/runtime/protocols/debug"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
"v.io/x/ref/services/mounttable/mounttablelib"
"v.io/x/ref/test"
"v.io/x/ref/test/testutil"
diff --git a/runtime/internal/rpc/test/full_test.go b/runtime/internal/rpc/test/full_test.go
index 7c99968..6715e4f 100644
--- a/runtime/internal/rpc/test/full_test.go
+++ b/runtime/internal/rpc/test/full_test.go
@@ -37,9 +37,9 @@
vsecurity "v.io/x/ref/lib/security"
"v.io/x/ref/lib/security/bcrypter"
"v.io/x/ref/runtime/internal/flow/crypto"
- "v.io/x/ref/runtime/internal/lib/tcputil"
inaming "v.io/x/ref/runtime/internal/naming"
"v.io/x/ref/runtime/protocols/debug"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
"v.io/x/ref/test"
"v.io/x/ref/test/testutil"
)
diff --git a/runtime/internal/lib/tcputil/tcputil.go b/runtime/protocols/lib/tcputil/tcputil.go
similarity index 100%
rename from runtime/internal/lib/tcputil/tcputil.go
rename to runtime/protocols/lib/tcputil/tcputil.go
diff --git a/runtime/internal/lib/xwebsocket/conn.go b/runtime/protocols/lib/websocket/conn.go
similarity index 99%
rename from runtime/internal/lib/xwebsocket/conn.go
rename to runtime/protocols/lib/websocket/conn.go
index 7d2c248..3ae0f71 100644
--- a/runtime/internal/lib/xwebsocket/conn.go
+++ b/runtime/protocols/lib/websocket/conn.go
@@ -4,7 +4,7 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"fmt"
diff --git a/runtime/internal/lib/xwebsocket/conn_nacl.go b/runtime/protocols/lib/websocket/conn_nacl.go
similarity index 98%
rename from runtime/internal/lib/xwebsocket/conn_nacl.go
rename to runtime/protocols/lib/websocket/conn_nacl.go
index 951fe0c..9ad2ea4 100644
--- a/runtime/internal/lib/xwebsocket/conn_nacl.go
+++ b/runtime/protocols/lib/websocket/conn_nacl.go
@@ -4,7 +4,7 @@
// +build nacl
-package xwebsocket
+package websocket
import (
"net"
diff --git a/runtime/internal/lib/xwebsocket/conn_test.go b/runtime/protocols/lib/websocket/conn_test.go
similarity index 98%
rename from runtime/internal/lib/xwebsocket/conn_test.go
rename to runtime/protocols/lib/websocket/conn_test.go
index c8c6357..3f0263f 100644
--- a/runtime/internal/lib/xwebsocket/conn_test.go
+++ b/runtime/protocols/lib/websocket/conn_test.go
@@ -4,7 +4,7 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"bytes"
diff --git a/runtime/internal/lib/xwebsocket/errors.vdl b/runtime/protocols/lib/websocket/errors.vdl
similarity index 93%
rename from runtime/internal/lib/xwebsocket/errors.vdl
rename to runtime/protocols/lib/websocket/errors.vdl
index 3339785..bb98884 100644
--- a/runtime/internal/lib/xwebsocket/errors.vdl
+++ b/runtime/protocols/lib/websocket/errors.vdl
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package xwebsocket
+package websocket
error (
ListenerClosed() {"en":"listener is already closed."}
diff --git a/runtime/internal/lib/xwebsocket/listener.go b/runtime/protocols/lib/websocket/listener.go
similarity index 98%
rename from runtime/internal/lib/xwebsocket/listener.go
rename to runtime/protocols/lib/websocket/listener.go
index 3e6c48b..f6f1301 100644
--- a/runtime/internal/lib/xwebsocket/listener.go
+++ b/runtime/protocols/lib/websocket/listener.go
@@ -4,7 +4,7 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"io"
@@ -16,7 +16,7 @@
"github.com/gorilla/websocket"
"v.io/x/ref/internal/logger"
- "v.io/x/ref/runtime/internal/lib/tcputil"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
"v.io/v23/context"
"v.io/v23/flow"
diff --git a/runtime/internal/lib/xwebsocket/listener_test.go b/runtime/protocols/lib/websocket/listener_test.go
similarity index 98%
rename from runtime/internal/lib/xwebsocket/listener_test.go
rename to runtime/protocols/lib/websocket/listener_test.go
index 4b5307e..0e36a93 100644
--- a/runtime/internal/lib/xwebsocket/listener_test.go
+++ b/runtime/protocols/lib/websocket/listener_test.go
@@ -4,7 +4,7 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"bytes"
diff --git a/runtime/internal/lib/xwebsocket/xwebsocket.vdl.go b/runtime/protocols/lib/websocket/websocket.vdl.go
similarity index 86%
rename from runtime/internal/lib/xwebsocket/xwebsocket.vdl.go
rename to runtime/protocols/lib/websocket/websocket.vdl.go
index f64630d..f34c7a7 100644
--- a/runtime/internal/lib/xwebsocket/xwebsocket.vdl.go
+++ b/runtime/protocols/lib/websocket/websocket.vdl.go
@@ -3,9 +3,9 @@
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
-// Package: xwebsocket
+// Package: websocket
-package xwebsocket
+package websocket
import (
"v.io/v23/context"
@@ -18,8 +18,8 @@
//////////////////////////////////////////////////
// Error definitions
var (
- ErrListenerClosed = verror.Register("v.io/x/ref/runtime/internal/lib/xwebsocket.ListenerClosed", verror.NoRetry, "{1:}{2:} listener is already closed.")
- ErrListenCalledInNaCl = verror.Register("v.io/x/ref/runtime/internal/lib/xwebsocket.ListenCalledInNaCl", verror.NoRetry, "{1:}{2:} Listen cannot be called in NaCl code.")
+ ErrListenerClosed = verror.Register("v.io/x/ref/runtime/protocols/lib/websocket.ListenerClosed", verror.NoRetry, "{1:}{2:} listener is already closed.")
+ ErrListenCalledInNaCl = verror.Register("v.io/x/ref/runtime/protocols/lib/websocket.ListenCalledInNaCl", verror.NoRetry, "{1:}{2:} Listen cannot be called in NaCl code.")
)
// NewErrListenerClosed returns an error with the ErrListenerClosed ID.
diff --git a/runtime/internal/lib/xwebsocket/ws.go b/runtime/protocols/lib/websocket/ws.go
similarity index 95%
rename from runtime/internal/lib/xwebsocket/ws.go
rename to runtime/protocols/lib/websocket/ws.go
index 0f5e4d6..66fad8a 100644
--- a/runtime/internal/lib/xwebsocket/ws.go
+++ b/runtime/protocols/lib/websocket/ws.go
@@ -4,7 +4,7 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"net"
@@ -12,7 +12,7 @@
"net/url"
"time"
- "v.io/x/ref/runtime/internal/lib/tcputil"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
"github.com/gorilla/websocket"
diff --git a/runtime/internal/lib/xwebsocket/ws_test.go b/runtime/protocols/lib/websocket/ws_test.go
similarity index 94%
rename from runtime/internal/lib/xwebsocket/ws_test.go
rename to runtime/protocols/lib/websocket/ws_test.go
index 2411030..d6325d7 100644
--- a/runtime/internal/lib/xwebsocket/ws_test.go
+++ b/runtime/protocols/lib/websocket/ws_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package xwebsocket_test
+package websocket_test
import (
"bytes"
@@ -10,8 +10,8 @@
"testing"
"time"
- "v.io/x/ref/runtime/internal/lib/tcputil"
- websocket "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
+ websocket "v.io/x/ref/runtime/protocols/lib/websocket"
"v.io/v23/context"
"v.io/v23/flow"
diff --git a/runtime/internal/lib/xwebsocket/wsh.go b/runtime/protocols/lib/websocket/wsh.go
similarity index 96%
rename from runtime/internal/lib/xwebsocket/wsh.go
rename to runtime/protocols/lib/websocket/wsh.go
index d09dc72..be83533 100644
--- a/runtime/internal/lib/xwebsocket/wsh.go
+++ b/runtime/protocols/lib/websocket/wsh.go
@@ -4,13 +4,13 @@
// +build !nacl
-package xwebsocket
+package websocket
import (
"net"
"time"
- "v.io/x/ref/runtime/internal/lib/tcputil"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
"v.io/v23/context"
"v.io/v23/flow"
diff --git a/runtime/internal/lib/xwebsocket/wsh_nacl.go b/runtime/protocols/lib/websocket/wsh_nacl.go
similarity index 97%
rename from runtime/internal/lib/xwebsocket/wsh_nacl.go
rename to runtime/protocols/lib/websocket/wsh_nacl.go
index b236914..ff0fa6e 100644
--- a/runtime/internal/lib/xwebsocket/wsh_nacl.go
+++ b/runtime/protocols/lib/websocket/wsh_nacl.go
@@ -4,7 +4,7 @@
// +build nacl
-package xwebsocket
+package websocket
import (
"net/url"
diff --git a/runtime/protocols/tcp/init.go b/runtime/protocols/tcp/init.go
index f0074d5..4425850 100644
--- a/runtime/protocols/tcp/init.go
+++ b/runtime/protocols/tcp/init.go
@@ -6,7 +6,7 @@
import (
"v.io/v23/flow"
- "v.io/x/ref/runtime/internal/lib/tcputil"
+ "v.io/x/ref/runtime/protocols/lib/tcputil"
)
func init() {
diff --git a/runtime/protocols/ws/init.go b/runtime/protocols/ws/init.go
index b2a2bf6..50c40f6 100644
--- a/runtime/protocols/ws/init.go
+++ b/runtime/protocols/ws/init.go
@@ -7,7 +7,7 @@
import (
"v.io/v23/flow"
- websocket "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ websocket "v.io/x/ref/runtime/protocols/lib/websocket"
)
func init() {
diff --git a/runtime/protocols/wsh/init.go b/runtime/protocols/wsh/init.go
index 2a1cd2a..39535cb 100644
--- a/runtime/protocols/wsh/init.go
+++ b/runtime/protocols/wsh/init.go
@@ -9,7 +9,7 @@
import (
"v.io/v23/flow"
- websocket "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ websocket "v.io/x/ref/runtime/protocols/lib/websocket"
)
func init() {
diff --git a/runtime/protocols/wsh_nacl/init.go b/runtime/protocols/wsh_nacl/init.go
index f7874de..990ec2a 100644
--- a/runtime/protocols/wsh_nacl/init.go
+++ b/runtime/protocols/wsh_nacl/init.go
@@ -9,7 +9,7 @@
import (
"v.io/v23/flow"
- websocket "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ websocket "v.io/x/ref/runtime/protocols/lib/websocket"
)
func init() {
diff --git a/services/wspr/browsprd/main_nacl.go b/services/wspr/browsprd/main_nacl.go
index fdb3fb5..5db496c 100644
--- a/services/wspr/browsprd/main_nacl.go
+++ b/services/wspr/browsprd/main_nacl.go
@@ -22,7 +22,7 @@
"v.io/x/ref/internal/logger"
vsecurity "v.io/x/ref/lib/security"
_ "v.io/x/ref/runtime/factories/chrome"
- "v.io/x/ref/runtime/internal/lib/xwebsocket"
+ "v.io/x/ref/runtime/protocols/lib/websocket"
"v.io/x/ref/services/wspr/internal/app"
"v.io/x/ref/services/wspr/internal/browspr"
"v.io/x/ref/services/wspr/internal/channel/channel_nacl"
@@ -62,7 +62,7 @@
browsprInst.initFileSystem()
// Give the websocket interface the ppapi instance.
- xwebsocket.PpapiInstance = inst
+ websocket.PpapiInstance = inst
// Set up the channel and register start rpc handler.
browsprInst.channel = channel_nacl.NewChannel(inst)