summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-29 00:44:34 +0700
committerShulhan <ms@kilabit.info>2022-07-29 00:44:47 +0700
commit9c1bcb8938c0b59e0395a7c26c5117e3a5dc0fc5 (patch)
tree9aa118858fabfcf8bd0b64d78412962e6278c6f6
parentd1a4ca2ee5039cdc3c58ad76e50df619a6cdcb26 (diff)
downloadpakakeh.go-9c1bcb8938c0b59e0395a7c26c5117e3a5dc0fc5.tar.xz
lib/websocket: reformat and paraphrase some comments
-rw-r--r--lib/websocket/client.go9
-rw-r--r--lib/websocket/server.go6
-rw-r--r--lib/websocket/server_options.go4
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/websocket/client.go b/lib/websocket/client.go
index 59a53984..5768ee50 100644
--- a/lib/websocket/client.go
+++ b/lib/websocket/client.go
@@ -89,19 +89,18 @@ type Client struct {
conn net.Conn
// Headers The headers field can be used to pass custom headers during
- // handshake with server. Any primary header fields ("host",
- // "upgrade", "connection", "sec-websocket-key",
- // "sec-websocket-version") will be deleted before handshake.
+ // handshake with server.
+ // Any primary header fields ("host", "upgrade", "connection",
+ // "sec-websocket-key", "sec-websocket-version") will be deleted
+ // before handshake.
Headers http.Header
remoteURL *url.URL
- //
// TLSConfig define custom TLS configuration when connecting to secure
// WebSocket server.
// The scheme of Endpoint must be "https" or "wss", or it will be
// resetting back to nil.
- //
TLSConfig *tls.Config
frame *Frame
diff --git a/lib/websocket/server.go b/lib/websocket/server.go
index 24c01a9b..074f5364 100644
--- a/lib/websocket/server.go
+++ b/lib/websocket/server.go
@@ -57,7 +57,8 @@ type Server struct {
routes *rootRoute
// handlePong callback that will be called after receiving control
- // PONG frame from client. Default is nil, used only for testing.
+ // PONG frame from client.
+ // Default is nil, used only for testing.
handlePong HandlerFrameFn
sock int
@@ -67,8 +68,7 @@ type Server struct {
allowRsv3 bool
}
-// NewServer will create new web-socket server that listen on specific port
-// number.
+// NewServer create new WebSocket server.
func NewServer(opts *ServerOptions) (serv *Server) {
if opts == nil {
opts = &ServerOptions{}
diff --git a/lib/websocket/server_options.go b/lib/websocket/server_options.go
index d1dd71c1..e2511360 100644
--- a/lib/websocket/server_options.go
+++ b/lib/websocket/server_options.go
@@ -14,6 +14,7 @@ const (
defServerStatusPath = "/status"
)
+// ServerOptions contain options to configure the WebSocket server.
type ServerOptions struct {
// HandleAuth callback that will be called when receiving
// client handshake.
@@ -51,7 +52,8 @@ type ServerOptions struct {
Address string
// ConnectPath define the HTTP path where WebSocket connection
- // handshake will be processed. Default to "/".
+ // handshake will be processed.
+ // Default to "/".
ConnectPath string
// StatusPath define a HTTP path to check for server status.