aboutsummaryrefslogtreecommitdiff
path: root/trunks.go
AgeCommit message (Collapse)Author
2024-02-07all: rename the project to gorankusuShulhan
The original idea of "trunks" is because the core library that we use for load testing is named "vegeta" (from Dragon Ball) [1][2], and Vegeta has a son named Trunks. In English, trunks also have multiple meanings. In order to have a unique name, we rename the project to "gorankusu", which is a combination of "go" (the main programming language that built the application) and "torankusu" the Hepburn of "Trunks". [1]: https://github.com/tsenart/vegeta/ [2]: https://en.wikipedia.org/wiki/Vegeta Implements: https://todo.sr.ht/~shulhan/gorankusu/2
2024-02-05all: implement form input fileShulhan
The FormInput now can be set to FormInputKindFile that will rendered as "<input type='file' ...>" on the web user interface. Once submitted, the file name, type, size, and lastModification will be stored under FormInput Filename, Filetype, Filesize, and Filemodms. Implements: https://todo.sr.ht/~shulhan/trunks/1
2024-02-05all: add type to customize how to dump HTTP request and responseShulhan
The HTTPRequestDumper define an handler to convert [http.Request] into [RunResponse] DumpRequest. The HTTPResponseDumper define an handler to convert [http.Response] into [RunResponse] DumpResponse.
2024-01-25all: fix warnings recommended by linter reviveShulhan
Most of the fixes related to naming variables with acronyms, for example HTTP, JSON, URL, and so on.
2024-01-25all: support parameter binding in HTTP PathShulhan
If HTTP Path contains key, for example "/:book", and the Params contains the same key, the Path will be filled with value from Params. The same key in Params will be deleted and not send on query parameter or body.
2023-11-11Release trunks v0.4.1 (2023-11-11)v0.4.1Shulhan
This release only have chores, it should not break anything. * go.mod: update all dependencies This changes set minimum Go version to version 1.20. The vegeta module finally has some update to v12.11.1. * gitmodules: use https instead of git scheme Using git scheme require private key to clone the remote repository. * _www: update wui module * _www: setup eslint for linting TypeScript files This changes also apply all eslint recommendations. * Makefile: replace the Go linter and apply all their recommendations Previously, we use golangci-lint as linter. This linter does not provides any useful recommendation lately and the development is quite a mess, sometimes its break when using Go tip. In this changes we replace it with revive, fieldalignment, and shadow; and fix all of their recommendations.
2023-11-11Makefile: replace the Go linter and apply all their recommendationsShulhan
Previously, we use golangci-lint as linter. This linter does not provides any useful recommendation lately and the development is quite a mess, sometimes its break when using Go tip. In this changes we replace it with revive, fieldalignment, and shadow; and fix all of their recommendations.
2023-05-16Release trunks v0.4.0 (2023-05-16)v0.4.0Shulhan
=== Bug fixes * all: fix panic when attacking HTTP due to nil Attack handler === Enhancements * _www: replace WebSocket handlers with HTTP endpoints * all: add boolean Kind for FormInput, FormInputKindBoolean * all: check and call ConvertParams when running HttpTarget === Chores * all: move the _doc directory under _www * all: convert the README from asciidoc to markdown * all: remove WebSocket server * go.mod: set Go version to 1.19 and update all dependencies
2023-05-16all: remove WebSocket serverShulhan
Using WebSocket for communication in client require additional setup, especially if its behind proxy. For example, if we server the trunks server under domain testing.local behind proxy, we need to setup route for the WebSocket too.
2023-05-16all: implement HTTP API to run and cancel attack on HTTP targetShulhan
This endpoints similar that we have in the WebSocket. The idea is to replace the WebSocket endpoints with this one.
2023-05-16all: fix panic when attacking HTTP due to nil Attack handlerShulhan
In attack endpoint, check if the Attack is nil before we push the request to attack queue.
2023-05-05all: set the request ConvertParams before calling runHttpTargetShulhan
The req, RunRequest instance, is from request so the HttpTarget.ConvertParams need to be set from the original HttpTarget. This fix the conditional rr.HttpTarget.ConvertParams == nil always true when calling runHttpTarget.
2023-05-05all: check and call ConvertParams when running HttpTargetShulhan
If the ConvertParams field is set, use it to convert the parameters into desired type.
2022-08-25Release trunks v0.3.0 (2022-08-25)v0.3.0Shulhan
This release set the minimum Go version to 1.18 and update all modules. == Chores * all: group all documentations under directory _doc * example: fix the HTTP POST handler * all: remove unused field Locker in RunRequest * all: fix all linter warnings
2022-08-21all: remove trailing new line on each mlog formatShulhan
The mlog functions automatically add new line to each format, so we did not need to add it manually.
2022-08-21all: reformat with Go 1.19 gofmtShulhan
2022-03-14all: changes the license of trunks software to GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl for more information.
2022-02-05Release trunks v0.1.0 (2022-02-05)v0.1.0Shulhan
Module trunks is a library and HTTP service that provide web user interface to test HTTP service, similar to Postman, and for load testing. For the load testing we use vegeta [1] as the backend.
2022-01-10all: update share and ciigo modulesShulhan
2021-12-21all: add feature to register custom navigation linkShulhan
Using Trunks.RegisterNavLink, one can register custom link into left navigation menu.
2021-12-10all: realign all structsShulhan
Changes, * AttackResult storage size decreased -24 bytes * Environment storage size decreased -32 bytes * HttpTarget storage size decreased -24 bytes * RunRequest storage size decreased -32 bytes * RunResponse storage size decreased -8 bytes * Target storage size decreased -16 bytes * WebSocketTarget storage size decreased -8 bytes
2021-10-17all: merge all workers for related to development to internal/cmdShulhan
Previously, we have a workers to recompile TypeScript and regenerate HTML files from adoc inside the Trunks type. The workers will run if the environment variable TRUNKS_DEV set to non-zero. This changes move those workers to the internal/cmd/trunks-example, because those workers are related for development only not for running Trunks server.
2021-09-29all: implement WebSocket notification when attack finishedShulhan
When the attack finished, the WebSocket server will broadcast the result to all clients as message "/_trunks/api/attack/result".
2021-09-28all: change the environment to set WebSocket port instead of addressShulhan
Setting the websocket listen address on environment require, re-parsing address port on the web side to connect to the server. In order to simplify creating connection on client, we set only the websocket port in the environment.
2021-09-27all: minimize recompilation on changes on _wwwShulhan
Instead of re-run the commands to recompile and embed for each file changes on _www, we queue changes into channel and run the recompile only if the channel is not empty.
2021-09-27all: implement WebSocket APIShulhan
The WebSocket API replace the HTTP APIs for running and canceling attack. Later, it will use to notify the result of attack.
2021-09-26all: unembed HTTP server on TrunksShulhan
Since we will implement API using WebSocket later, we need to split between the one that manage HTTP and one that manage WebSocket.
2021-09-25all: simplify development on trunks-exampleShulhan
Previously to developer and test trunks on local we need to run "tsc -w" on directory _www to watch and recompile any changes to TypeScript files, and run "go run ./cmd/trunks-example" to view the Trunks web interface. Since we will have internal documentation inside _www/docs, we need to run another ciigo server that watch any changes to .adoc files and convert it to HTML. Three separate commands for development. This changes refactoring the development process by running two goroutines when TRUNKS_DEV environment variable is set to non-empty. One goroutine watch any changes to TypeScript, HTML, and tsconfig files inside the _www, and when there is an update it will execute "tsc -p" to recompile and "go run ./internal/generate-memfs" to embed them into Go source. Another goroutine watch any changes to .adoc files inside "_www/docs" directory and convert them into HTML files. This goroutine will running in the background while the HTTP server is running too.
2021-09-25all: check and convert HTTP target parameters to multipart/form-dataShulhan
If the content-type of request is multipart/form-data, convert the parameters in HttpTarget using ToMultipartFormData().
2021-09-25all: prevent leaking Target and HttpTarget headers and variablesShulhan
In case two or more users access the Trunks web and set the target variables, the last user that run any HttpTarget will set the Target variables or HttpTarget headers/variables. The next user that open the Trunks web will see the values of headers and variables from the latest run. This changes fix this issue by generating new RunRequest using request original target
2021-09-23all: convert the params to JSON objectShulhan
Since the HttpTarget Params type changes to KeyFormInput, we cannot use the Params directly but need to convert it JSON object first using map[string]interface{}.
2021-04-09all: wrap the websocket Run response inside the EndpointResponseShulhan
Any response from the trunks API must have the following format, { "code": <number>, "message": <number>, "data": <object> }
2021-04-09all: fix HTTP Run not called when executed from APIShulhan
2021-04-09all: fix double slash when logging attack URLShulhan
2021-04-09all: check for nil PreAttack when on worker attack queueShulhan
If the HttpTarget.PreAttack is not set we should not call it. While at it, reset the RunRequest result to nil at the end of attack.
2021-03-27all: change the Run result to return dump of HTTP request and responseShulhan
Previously, we display the actual response of the HTTP target only on the user interface. This changes make the Run function to display the actual HTTP request and response that being send and received on HTTP target.
2021-03-27all: allow client to customize request method, path, and typeShulhan
Previously, the HttpTarget Method, Path, and RequestType is fixed. Once its declared, the Run method will use the defined values to generate and call HTTP request. This changes add IsCustomizable field on HttpTarget. If its true, client or web user interface can modify the request method, path, and type. The values send by client to server after changes will be used instead of the fixed values. This changes also make the Run handler on HttpTarget to be optional. If its not defined, it will generated the HTTP request from the method, path, and type passed to server.
2021-03-24all: fix and update linter warningsShulhan
Check for error where it should and remove unused return and methods.
2021-03-24all: implement target for WebSocketShulhan
One can register WebSocketTarget just like HttpTarget, its have ID, Name, Headers, and Params. Unlike HTTP, the WebSocket target only able to execute Run, it does not have "Attack", yet.
2021-03-24all: move BaseUrl from AttackOptions to TargetShulhan
The BaseUrl seems like not a good fit on AttackOptions since its should never changes, so we move it to the Target.
2021-03-21all: implement interface and API to cancel running attackShulhan
On the top of the page, it will display currently running attack with target name and HTTP target name. User can cancel the attack by clicking "Cancel" button on the right.
2021-03-21all: implement interface and API to delete attack resultShulhan
When user clicking the "Delete" button on attack result item, it will send request to API to delete the selected item. Server will check if the requested result file name exist and delete them from file system if its exist, otherwise it will return 404 Not found.
2021-03-21all: load pass attack results and implement function to get attack resultShulhan
When the service started, it will load all previous attack results from directory Environment.ResultsDir. It will only scan the file name and append it to HttpTarget.Results due to the size and time to load one of them can take time. Through the web interface, user can click "Show" button to load the result and display it on the screen.
2021-03-21all: various changesShulhan
* Increase the DEBUG value to 3 to match with latest libhttp fix debug output of client request * _www: fix rendering HTTP headers, missing "target" parameter * Remove unused "IsRunning" from AttackResult * example: add an example endpoint for POST with x-www-form-urlencoded * Remove parameter Target on HttpRunHandler. The Target value can be retrieved from RunRequest.Target. * Target: change the field Vars type from map[string]string to KeyValue * Trunks: merge Target and HttpRequest from request to original Target and HttpTarget respectively before calling Run * Prefix the result file name with Target.ID * Move the package documentation to doc.go
2021-03-21all: rename loadTestingResult to AttackResultShulhan
2021-03-21all: implement API and interface for attack functionalityShulhan
When the user click "Attack" it will call the API to run the load testing. If there is load testing currently, it will return with an error. On success, the result of load testing will be stored on directory defined in Environment.ResultsDir with file named <HttpTarget.ID>.<date_time>.<RPS>x<Duration>s.<ResultsSuffix>.bin This file contains the vegeta.Results.
2021-03-15trunks: a module for testing HTTP servicesShulhan
Trunks is a library and HTTP service that provide web user interface to test HTTP service, similar to Postman, and for load testing. For the load testing we use vegeta [1] as the backend. [1] https://github.com/tsenart/vegeta