summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-02-04 16:16:20 +0700
committerShulhan <ms@kilabit.info>2024-02-04 16:16:20 +0700
commit30bbaec568592dbe8e23fa56068d4df06be90753 (patch)
tree35db05d3ec01ab7d51854f005ba606d4c32dee09
parent34aa031f1e7e4b3efe9ee9a8610d7199389125e2 (diff)
downloadgorankusu-30bbaec568592dbe8e23fa56068d4df06be90753.tar.xz
http_server: group HTTP paths API into constants
-rw-r--r--http_server.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/http_server.go b/http_server.go
index 37c5988..46c2e8a 100644
--- a/http_server.go
+++ b/http_server.go
@@ -16,26 +16,33 @@ import (
const (
pathAPIAttackHTTP = `/_trunks/api/attack/http`
pathAPIAttackResult = `/_trunks/api/attack/result`
+
+ pathAPIEnvironment = `/_trunks/api/environment`
+ pathAPINavlinks = `/_trunks/api/navlinks`
+
+ pathAPITargetRunHTTP = `/_trunks/api/target/run/http`
+ pathAPITargetRunWebSocket = `/_trunks/api/target/run/websocket`
+ pathAPITargets = `/_trunks/api/targets`
)
// List of HTTP APIs provided by Trunks HTTP server.
var (
apiEnvironmentGet = &libhttp.Endpoint{
Method: libhttp.RequestMethodGet,
- Path: "/_trunks/api/environment",
+ Path: pathAPIEnvironment,
RequestType: libhttp.RequestTypeJSON,
ResponseType: libhttp.ResponseTypeJSON,
}
apiAttackHTTP = libhttp.Endpoint{
Method: libhttp.RequestMethodPost,
- Path: `/_trunks/api/attack/http`,
+ Path: pathAPIAttackHTTP,
RequestType: libhttp.RequestTypeJSON,
ResponseType: libhttp.ResponseTypeJSON,
}
apiAttackHTTPCancel = libhttp.Endpoint{
Method: libhttp.RequestMethodDelete,
- Path: `/_trunks/api/attack/http`,
+ Path: pathAPIAttackHTTP,
RequestType: libhttp.RequestTypeJSON,
ResponseType: libhttp.ResponseTypeJSON,
}
@@ -55,27 +62,27 @@ var (
apiNavLinks = &libhttp.Endpoint{
Method: libhttp.RequestMethodGet,
- Path: "/_trunks/api/navlinks",
+ Path: pathAPINavlinks,
RequestType: libhttp.RequestTypeNone,
ResponseType: libhttp.ResponseTypeJSON,
}
apiTargetRunHTTP = &libhttp.Endpoint{
Method: libhttp.RequestMethodPost,
- Path: "/_trunks/api/target/run/http",
+ Path: pathAPITargetRunHTTP,
RequestType: libhttp.RequestTypeJSON,
ResponseType: libhttp.ResponseTypeJSON,
}
apiTargetRunWebSocket = &libhttp.Endpoint{
Method: libhttp.RequestMethodPost,
- Path: "/_trunks/api/target/run/websocket",
+ Path: pathAPITargetRunWebSocket,
RequestType: libhttp.RequestTypeJSON,
ResponseType: libhttp.ResponseTypeJSON,
}
apiTargets = &libhttp.Endpoint{
Method: libhttp.RequestMethodGet,
- Path: "/_trunks/api/targets",
+ Path: pathAPITargets,
RequestType: libhttp.RequestTypeNone,
ResponseType: libhttp.ResponseTypeJSON,
}