From 524962c1c8e26cec26fa356719ed990a4a4c82f1 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 21 Mar 2021 04:32:03 +0700 Subject: all: remove unused request and WebSocketTarget types The request type has been replaced with RunRequest. The WebSocketTarget may be used again later, but let remove then now to make the documentation clear. --- request.go | 21 --------------------- websocket_target.go | 41 ----------------------------------------- 2 files changed, 62 deletions(-) delete mode 100644 request.go delete mode 100644 websocket_target.go diff --git a/request.go b/request.go deleted file mode 100644 index 60ba48a..0000000 --- a/request.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021, Shulhan . All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package trunks - -import "encoding/json" - -// -// request represent generic request. -// -type request struct { - Env *Environment - Target *HttpTarget - WebSocketTarget *WebSocketTarget - Result *loadTestingResult -} - -func (req *request) unpack(b []byte) error { - return json.Unmarshal(b, req) -} diff --git a/websocket_target.go b/websocket_target.go deleted file mode 100644 index 2353bc3..0000000 --- a/websocket_target.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2021, Shulhan . All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package trunks - -import ( - "strings" - - "github.com/shuLhan/share/lib/ascii" -) - -type websocketRunHandler func(wstarget *WebSocketTarget, req *request) ([]byte, error) - -type WebSocketTarget struct { - ID string - Name string - Status string - Params map[string]string - - // connectPath define the path on server where connection should be - // open, for example "/" or "/ws". - connectPath string - reqMethod string - reqTarget string - - // runHandler define a function that will be called to run the test. - runHandler websocketRunHandler -} - -func (wstarget *WebSocketTarget) init() { - if len(wstarget.ID) == 0 { - name := []byte(strings.ToLower(wstarget.Name)) - for x := 0; x < len(name); x++ { - if !ascii.IsAlnum(name[x]) { - name[x] = '_' - } - } - wstarget.ID = string(name) - } -} -- cgit v1.3