aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/frames_test.go
AgeCommit message (Collapse)Author
2025-01-22lib/bytes: replace Copy and Concat with standard libraryShulhan
Since Go 1.20, the standard bytes package have the Copy function. Since Go 1.22, the standard slices package have the Concat function.
2024-03-02all: move the repository to "git.sr.ht/~shulhan/pakakeh.go"Shulhan
There are several reasons that why we move from github.com. First, related to the name of package. We accidentally name the package with "share" a common word in English that does not reflect the content of repository. By moving to other repository, we can rename it to better and unique name, in this "pakakeh.go". Pakakeh is Minang word for tools, and ".go" suffix indicate that the repository related to Go programming language. Second, supporting open source. The new repository is hosted under sourcehut.org, the founder is known to support open source, and all their services are licensed under AGPL, unlike GitHub that are closed sources. Third, regarding GitHub CoPilot. The GitHub Terms of Service [1], allow any public content that are hosted there granted them to parse the content. On one side, GitHub helps and flourish the open source, but on another side have an issues regarding scraping the copyleft license [2]. [1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us [2]: https://githubcopilotinvestigation.com
2022-06-09lib/websocket: realign all struct to minimize allocationsShulhan
Changes, * Client: from 176 to 144 (-32 bytes) * ClientManager: from 64 to 40 (-24 bytes) * Request: from 88 to 72 (-16 bytes) * Response: from 40 to 24 (-16 bytes) * route: from 48 to 32 (-16 bytes) * Server: from 72 to 64 (-8 bytes) * ServerOptions: from 104 to 96 (s-8 bytes) Plus other structs in the tests.
2021-03-14all: refactoring the test.Assert and test.AssertBench signatureShulhan
Previously, the test.Assert and test.AssertBench functions has the boolean parameter to print the stack trace of test in case its not equal. Since this parameter is not mandatory and its usually always set to "true", we remove them from function signature to simplify the call to Assert and AssertBench.
2020-08-11websocket: reformat some filesShulhan
2019-03-17websocket: simplify handling chopped frameShulhan
Previously, we use two function to unpack frame: frameUnpack and continueUnpack, both of this functions actually use the same logic. This commit merge both functions into Frame's unpack() and which also make handleChopped() to be unused on both server and client.
2019-03-12websocket: export the opcode typeShulhan
The opcode type is required to create new frame and to get the opcode in continous frames.
2019-03-12websocket: unexport internal methods and remove unused methodsShulhan
Some of the methods in ClientManager and Frames should be only accessed by internal server, not by implementor.
2019-03-05websocket: replace concatBytes with our bytes.ConcatShulhan
function Concat in package bytes is more flexible, allow two or more slice of byte in parameters.
2019-03-05websocket: change the Unpack return type to FramesShulhan
Continuing refactor, the Frames type provide methods than can used to handle packet from other endpoint.
2019-03-05websocket: unexported the Frame fields Fin and MaskedShulhan
Continuing refactor, this commit unexport all fields in Frame to allow user focus working with method and packet, let the technical detail managed by library.
2019-03-04websocket: minimize global variables and unexport internal constantsShulhan
Most of the constants should not be used directly, as we prefer user to use the functions or methods based access.
2019-03-04websocket: add type for continuous (fragmented) frameShulhan
A type Frames is actually a wrapper to slice of frame. We prefer if user is not directly access to underlying frames but focus on payload instead.