aboutsummaryrefslogtreecommitdiff
path: root/http_target.go
AgeCommit message (Collapse)Author
2024-06-08all: use [route.Path] to generate parametersShulhan
Using [route.String] does not works if the parameter can be empty, while [route.Path] replace all keys and return the path as is.
2024-03-15all: update module pakakeh.go to the tipShulhan
On the "lib/http" we refactoring RequestMethod and RequestType type from int to string for readability, when the value is encoded, for example to JSON. So instead of 0, 1 or 2; it will print "GET", "CONNECT", or "HEAD".
2024-03-05all: replace module "share" with "pakakeh.go"Shulhan
2024-02-16all: add default HTTPRunHandlerShulhan
Previously, the default HTTPRunHandler is hidden, called dynamically based on Run is nil or not. This changes make it exported as function that return HTTPRunHandler to show how define and create a custom HTTPRunHandler.
2024-02-16all: add default HTTPParamsConverter for [HTTPTarget.ParamsConverter]Shulhan
The DefaultParamsConverter define default function to convert [HTTPTarget.Params] to its equivalent parameters in HTTP, either as query in URL or as bytes in body. This changes introduce breaking changes in HTTPTarget where field ConvertParams renamed to ParamsConverter.
2024-02-16all: change the signature of default request/response dumperShulhan
Instead of function that use the signature of HTTPRequestDumper/ HTTPResponseDumper; change it to function that _return_ HTTPRequestDumper/ HTTPResponseDumper. In this way, the documentation can show the clear relation between function and its type.
2024-02-16all: set default HTTPTarget Attack if its not setShulhan
Previously, the function for Attack need to be coded manually. This changes introduce new function DefaultHTTPAttack that generate HTTPAttackHandler based on the HTTPTarget method, request type, and Params; if AllowAttack is true and Attack is nil. Implements: https://todo.sr.ht/~shulhan/gorankusu/4
2024-02-08all: allow submit free form request body in HTTPTargetShulhan
In HTTPTarget the field RawBody can be filled by anything by user. Those field can be activated by setting WithRawBody. Implements: https://todo.sr.ht/~shulhan/gorankusu/3
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-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.
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: fix all linter warningsShulhan
Some linter, govet, warns about possible copied Mutex on HttpRequest. To fix this we implement method clone and Stringer on HttpRequest.
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.
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-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-19all: add option to set description (Hint) on any inputs elementShulhan
This changes refactor the KeyValue from map[string]string into map[string]FormInput, where FormInput is a struct with Label, Hint, Kind, Value, Max, and Min. With the available of Hint field, the web user interface can render it as description of input. This changes also make all input hint to be displayed on the first render.
2021-09-18all: add "Hint" for Target, HTTP, and WebSocket TargetShulhan
The "Hint" provide a general description for Target, a single HttpTarget, and WebSocketTarget.
2021-08-06all: add an handler ConvertParams to HttpTargetShulhan
The ConvertParams is a function that will be called inside the Run handler to convert the Params values to type that will be send as request.
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-27all: make the HttpTarget Name to be requiredShulhan
Previously, the HttpTarget Name field is optional, and the ID is derived from Path. This changes make the Name field become required and changes the ID to be derived from Name instead of Path, because one or more same path can be used by more HttpTarget.
2021-03-24all: fix and update linter warningsShulhan
Check for error where it should and remove unused return and methods.
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 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-16all: update the vegeta to use module pathShulhan
The correct module name registered on go.mod is github.com/tsenart/vegeta/v12.
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