aboutsummaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-03-21 23:24:46 +0700
committerShulhan <ms@kilabit.info>2021-03-21 23:24:46 +0700
commit7fed1f75a32c161ba0d296dbb7b6dc14e831336e (patch)
treea2d4f65b11a20aefaad4738f3a02a0b908ccb1b8 /errors.go
parent360bf84d2af244c7926c2aa7c1f23d0c280b8238 (diff)
downloadgorankusu-7fed1f75a32c161ba0d296dbb7b6dc14e831336e.tar.xz
all: implement interface and API to cancel running attack
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.
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/errors.go b/errors.go
index 29dcfee..f5f04b4 100644
--- a/errors.go
+++ b/errors.go
@@ -12,14 +12,15 @@ import (
libhttp "github.com/shuLhan/share/lib/http"
)
-func errAttackConflict(ar *AttackResult) error {
+func errAttackConflict(rr *RunRequest) error {
res := &libhttp.EndpointResponse{
E: liberrors.E{
- Code: http.StatusConflict,
- Message: "another attack is already running",
- Name: "ERR_ATTACK_CONFLICT",
+ Code: http.StatusConflict,
+ Message: fmt.Sprintf(`Another attack is already running: "%s/%s`,
+ rr.Target.Name, rr.HttpTarget.Name),
+ Name: "ERR_ATTACK_CONFLICT",
},
- Data: ar,
+ Data: rr,
}
return res
}