diff options
| author | Shulhan <ms@kilabit.info> | 2024-02-16 00:25:09 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-02-16 01:38:51 +0700 |
| commit | 2deaf8c4cc0f941e9c0f2c9fc079d86c1d6a8d61 (patch) | |
| tree | cd62ded5534c7397025976902d2ad70ab0af64b0 /example.go | |
| parent | 2b6dc0730aa3c30787e440c1090b8041ff6b4ca8 (diff) | |
| download | gorankusu-2deaf8c4cc0f941e9c0f2c9fc079d86c1d6a8d61.tar.xz | |
example: check for error and set default attack duration to 10 seconds
Diffstat (limited to 'example.go')
| -rw-r--r-- | example.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -155,6 +155,9 @@ func (ex *Example) registerEndpoints() (err error) { ResponseType: libhttp.ResponseTypeJSON, Call: ex.pathExamplePost, }) + if err != nil { + return err + } err = ex.Gorankusu.Httpd.RegisterEndpoint(&libhttp.Endpoint{ Method: libhttp.RequestMethodPost, @@ -163,6 +166,9 @@ func (ex *Example) registerEndpoints() (err error) { ResponseType: libhttp.ResponseTypeJSON, Call: ex.pathExamplePost, }) + if err != nil { + return err + } err = ex.Gorankusu.Httpd.RegisterEndpoint(&libhttp.Endpoint{ Method: libhttp.RequestMethodPost, @@ -171,6 +177,9 @@ func (ex *Example) registerEndpoints() (err error) { ResponseType: libhttp.ResponseTypeJSON, Call: ex.pathExampleRawbodyJSON, }) + if err != nil { + return err + } err = ex.Gorankusu.Httpd.RegisterEndpoint(&libhttp.Endpoint{ Method: libhttp.RequestMethodPost, @@ -179,8 +188,11 @@ func (ex *Example) registerEndpoints() (err error) { ResponseType: libhttp.ResponseTypeJSON, Call: ex.pathExampleUpload, }) + if err != nil { + return err + } - return err + return nil } func (ex *Example) registerWebSocketEndpoints() (err error) { @@ -198,7 +210,7 @@ func (ex *Example) registerTargetHTTP() (err error) { Hint: `This section provide an example of HTTP endpoints that can be tested and attacked.`, BaseURL: fmt.Sprintf(`http://%s`, ex.Gorankusu.Env.ListenAddress), Opts: &AttackOptions{ - Duration: 300 * time.Second, + Duration: 10 * time.Second, RatePerSecond: 1, }, Vars: KeyFormInput{ |
