summaryrefslogtreecommitdiff
path: root/src/pkg/websocket/websocket.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-10-06 09:35:45 +0200
committerOndřej Surý <ondrej@sury.org>2011-10-06 09:35:45 +0200
commit6c7ca6e4d4e26e4c8cbe0d183966011b3b088a0a (patch)
treefddeb87db026d64a1d8e597dd0c69d685f433597 /src/pkg/websocket/websocket.go
parent04f99b387021a8ce32a8795360cba9beaf986a81 (diff)
downloadgolang-6c7ca6e4d4e26e4c8cbe0d183966011b3b088a0a.tar.gz
Imported Upstream version 2011.09.21upstream-weekly/2011.09.21
Diffstat (limited to 'src/pkg/websocket/websocket.go')
-rw-r--r--src/pkg/websocket/websocket.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/pkg/websocket/websocket.go b/src/pkg/websocket/websocket.go
index 1d063c31f..d57d1149c 100644
--- a/src/pkg/websocket/websocket.go
+++ b/src/pkg/websocket/websocket.go
@@ -57,16 +57,13 @@ var (
ErrNotSupported = ProtocolError{"not supported"}
)
-// WebSocketAddr is an implementation of net.Addr for WebSocket.
-type WebSocketAddr struct {
+// Addr is an implementation of net.Addr for WebSocket.
+type Addr struct {
*url.URL
}
// Network returns the network type for a WebSocket, "websocket".
-func (addr WebSocketAddr) Network() string { return "websocket" }
-
-// String returns the network address for a WebSocket.
-func (addr WebSocketAddr) String() string { return addr.String() }
+func (addr *Addr) Network() string { return "websocket" }
// Config is a WebSocket configuration
type Config struct {
@@ -222,18 +219,18 @@ func (ws *Conn) IsServerConn() bool { return ws.request != nil }
// the WebSocket location for server.
func (ws *Conn) LocalAddr() net.Addr {
if ws.IsClientConn() {
- return WebSocketAddr{ws.config.Origin}
+ return &Addr{ws.config.Origin}
}
- return WebSocketAddr{ws.config.Location}
+ return &Addr{ws.config.Location}
}
// RemoteAddr returns the WebSocket location for the connection for client, or
// the Websocket Origin for server.
func (ws *Conn) RemoteAddr() net.Addr {
if ws.IsClientConn() {
- return WebSocketAddr{ws.config.Location}
+ return &Addr{ws.config.Location}
}
- return WebSocketAddr{ws.config.Origin}
+ return &Addr{ws.config.Origin}
}
// SetTimeout sets the connection's network timeout in nanoseconds.