diff options
| author | Shulhan <ms@kilabit.info> | 2019-03-12 02:43:33 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-03-12 02:43:33 +0700 |
| commit | 085f158b6561cf511d6ad125dd01cebcfbf7d96f (patch) | |
| tree | 9819719025206d9655bcab71d9bd0083d56448ca /lib/websocket/frames.go | |
| parent | 23f280d1adeb70cf4434e3c58859d466bc76239c (diff) | |
| download | pakakeh.go-085f158b6561cf511d6ad125dd01cebcfbf7d96f.tar.xz | |
websocket: unexport internal methods and remove unused methods
Some of the methods in ClientManager and Frames should be only accessed
by internal server, not by implementor.
Diffstat (limited to 'lib/websocket/frames.go')
| -rw-r--r-- | lib/websocket/frames.go | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/lib/websocket/frames.go b/lib/websocket/frames.go index 1fa40df2..b54346b9 100644 --- a/lib/websocket/frames.go +++ b/lib/websocket/frames.go @@ -63,19 +63,9 @@ func (frames *Frames) Append(f *Frame) { } // -// Get frame at specific index or nil if index out of range. +// isClosed will return true if one of the frame is control CLOSE frame. // -func (frames *Frames) Get(x int) *Frame { - if x < 0 || x >= len(frames.v) { - return nil - } - return frames.v[x] -} - -// -// IsClosed will return true if one of the frame is control CLOSE frame. -// -func (frames *Frames) IsClosed() bool { +func (frames *Frames) isClosed() bool { if len(frames.v) == 0 { return false } @@ -88,13 +78,6 @@ func (frames *Frames) IsClosed() bool { } // -// Len return the number of frame. -// -func (frames *Frames) Len() int { - return len(frames.v) -} - -// // Opcode return the operation code of the first frame. // func (frames *Frames) Opcode() opcode { @@ -105,7 +88,7 @@ func (frames *Frames) Opcode() opcode { } // -// Payload return the concatenation of continuous data frame's payload. +// payload return the concatenation of continuous data frame's payload. // // The first frame must be a data frame, either text or binary, otherwise it // will be considered empty payload, even if frames list is not empty. @@ -113,7 +96,7 @@ func (frames *Frames) Opcode() opcode { // Any control CLOSE frame of frame with fin set will considered the last // frame. // -func (frames *Frames) Payload() (payload []byte) { +func (frames *Frames) payload() (payload []byte) { if len(frames.v) == 0 { return } |
