Skip to content

Commit

Permalink
Move runner to job package; runner/config to job/config; GA stats to …
Browse files Browse the repository at this point in the history
…metrics (#453)

* Rename jobs package to job, move GA statistics to metrics, minor edits

* Move runner/config to job/config
  • Loading branch information
jdoe7865623 authored Mar 28, 2022
1 parent dbd53bf commit 4ffefe8
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ builds:
- -extldflags "-static"
- -X github.com/Arriven/db1000n/src/utils/ota.Version={{ .Version }}
- -X github.com/Arriven/db1000n/src/utils.EncryptionKeys={{- .Env.ENCRYPTION_KEYS }}
- -X github.com/Arriven/db1000n/src/runner/config.DefaultConfig={{- .Env.DEFAULT_CONFIG_VALUE }}
- -X github.com/Arriven/db1000n/src/job/config.DefaultConfig={{- .Env.DEFAULT_CONFIG_VALUE }}
- -X github.com/Arriven/db1000n/src/utils/metrics.PushGatewayCA={{- .Env.CA_PATH_VALUE }}
- -X github.com/Arriven/db1000n/src/utils/metrics.BasicAuth={{- .Env.PROMETHEUS_BASIC_AUTH }}
archives:
Expand Down
2 changes: 1 addition & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ builds:
- -extldflags "-static"
- -X github.com/Arriven/db1000n/src/utils/ota.Version={{- .Env.VERSION }}
- -X github.com/Arriven/db1000n/src/utils.EncryptionKeys={{- .Env.ENCRYPTION_KEYS }}
- -X github.com/Arriven/db1000n/src/runner/config.DefaultConfig={{- .Env.DEFAULT_CONFIG_VALUE }}
- -X github.com/Arriven/db1000n/src/job/config.DefaultConfig={{- .Env.DEFAULT_CONFIG_VALUE }}
- -X github.com/Arriven/db1000n/src/utils/metrics.PushGatewayCA={{- .Env.CA_PATH_VALUE }}
- -X github.com/Arriven/db1000n/src/utils/metrics.BasicAuth={{- .Env.PROMETHEUS_BASIC_AUTH }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LDFLAGS += -X '$(REPOSITORY_BASE_PATH)/src/utils.EncryptionKeys=$(ENCRYPTION_KEY
BUILD_TAGS += encrypted
endif
ifneq ($(DEFAULT_CONFIG_VALUE),)
LDFLAGS += -X '$(REPOSITORY_BASE_PATH)/src/runner/config.DefaultConfig=$(DEFAULT_CONFIG_VALUE)'
LDFLAGS += -X '$(REPOSITORY_BASE_PATH)/src/job/config.DefaultConfig=$(DEFAULT_CONFIG_VALUE)'
endif
ifneq ($(CA_PATH_VALUE),)
LDFLAGS += -X '$(REPOSITORY_BASE_PATH)/src/utils/metrics.PushGatewayCA=$(CA_PATH_VALUE)'
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced-docs/config-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Build new binary with new config:
```sh
make build_encrypted

GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-X 'github.com/Arriven/db1000n/src/runner/config.DefaultConfig=YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCAwS1pOUXlLM004L1NxcDRwL21CaUl3IDE4Cjc1cEZtcmZZZHJieFRvd0hhM0RVVVMxb2VMY0RmQzBkUkJQMXE2UWdyMUEKLS0tIHlSK1VFMkNOSHovbzRqUlJ3RW5VclphRy9TU0NQSG8vMzJUZ1c4RUozZncKD6zE4MONozWBfQYn9HG31DW100o2oFpn6iACQAvCDyXkgSeuQtRFjPwCIW5q2Dltq7Srkc8b81/ZynC59uqkmDJefGyNPzTk3ilRl6wcLOhCP1TD7YtCtZ/7ZpoGpNMiDD6XhKnOmz10sBSy1SXt54+zFVcuQ1ITRi4E2WmiFRjTa8T+ZMwurW+F+iwOu6+z8/0sKQaG5SrKA74GI9D6iRQnqiPg2Abr97Vq7X2Fjvz2NqFjcB0dD29XijHcLCdXQ1DcI3gx94SdMmmfeU5ub2ArsH/4nA8XlS7YE7BirUihgHD4/KIr52dc+Fst6i7SBH433d/Y3Pmhi89FHY8+sGyPFXNG+SeLLHafcR6bLLGyk0iGa2bZaBqUGovYNojni8KSrLRPXTgCyeNAOS7Gpamwi1Xco7m7nEEmAv9vpEvtOUx83pGBOkgu3oSV0t3jmp+OUvcwMMQ='" -o main ./main.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-X 'github.com/Arriven/db1000n/src/job/config.DefaultConfig=YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCAwS1pOUXlLM004L1NxcDRwL21CaUl3IDE4Cjc1cEZtcmZZZHJieFRvd0hhM0RVVVMxb2VMY0RmQzBkUkJQMXE2UWdyMUEKLS0tIHlSK1VFMkNOSHovbzRqUlJ3RW5VclphRy9TU0NQSG8vMzJUZ1c4RUozZncKD6zE4MONozWBfQYn9HG31DW100o2oFpn6iACQAvCDyXkgSeuQtRFjPwCIW5q2Dltq7Srkc8b81/ZynC59uqkmDJefGyNPzTk3ilRl6wcLOhCP1TD7YtCtZ/7ZpoGpNMiDD6XhKnOmz10sBSy1SXt54+zFVcuQ1ITRi4E2WmiFRjTa8T+ZMwurW+F+iwOu6+z8/0sKQaG5SrKA74GI9D6iRQnqiPg2Abr97Vq7X2Fjvz2NqFjcB0dD29XijHcLCdXQ1DcI3gx94SdMmmfeU5ub2ArsH/4nA8XlS7YE7BirUihgHD4/KIr52dc+Fst6i7SBH433d/Y3Pmhi89FHY8+sGyPFXNG+SeLLHafcR6bLLGyk0iGa2bZaBqUGovYNojni8KSrLRPXTgCyeNAOS7Gpamwi1Xco7m7nEEmAv9vpEvtOUx83pGBOkgu3oSV0t3jmp+OUvcwMMQ='" -o main ./main.go
```

Your new binary saved as `main` with new encrypted and embedded default config.
Expand All @@ -184,5 +184,5 @@ You can embed keys into binary in same way:
export ENCRYPTION_KEYS='some long password to encrypt config&another key'
make build_encrypted

GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-X 'github.com/Arriven/db1000n/src/utils.EncryptionKeys=some long password to encrypt config&another key' -X 'github.com/Arriven/db1000n/src/runner/config.DefaultConfig=YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCAwS1pOUXlLM004L1NxcDRwL21CaUl3IDE4Cjc1cEZtcmZZZHJieFRvd0hhM0RVVVMxb2VMY0RmQzBkUkJQMXE2UWdyMUEKLS0tIHlSK1VFMkNOSHovbzRqUlJ3RW5VclphRy9TU0NQSG8vMzJUZ1c4RUozZncKD6zE4MONozWBfQYn9HG31DW100o2oFpn6iACQAvCDyXkgSeuQtRFjPwCIW5q2Dltq7Srkc8b81/ZynC59uqkmDJefGyNPzTk3ilRl6wcLOhCP1TD7YtCtZ/7ZpoGpNMiDD6XhKnOmz10sBSy1SXt54+zFVcuQ1ITRi4E2WmiFRjTa8T+ZMwurW+F+iwOu6+z8/0sKQaG5SrKA74GI9D6iRQnqiPg2Abr97Vq7X2Fjvz2NqFjcB0dD29XijHcLCdXQ1DcI3gx94SdMmmfeU5ub2ArsH/4nA8XlS7YE7BirUihgHD4/KIr52dc+Fst6i7SBH433d/Y3Pmhi89FHY8+sGyPFXNG+SeLLHafcR6bLLGyk0iGa2bZaBqUGovYNojni8KSrLRPXTgCyeNAOS7Gpamwi1Xco7m7nEEmAv9vpEvtOUx83pGBOkgu3oSV0t3jmp+OUvcwMMQ='" -o main ./main.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-X 'github.com/Arriven/db1000n/src/utils.EncryptionKeys=some long password to encrypt config&another key' -X 'github.com/Arriven/db1000n/src/job/config.DefaultConfig=YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCAwS1pOUXlLM004L1NxcDRwL21CaUl3IDE4Cjc1cEZtcmZZZHJieFRvd0hhM0RVVVMxb2VMY0RmQzBkUkJQMXE2UWdyMUEKLS0tIHlSK1VFMkNOSHovbzRqUlJ3RW5VclphRy9TU0NQSG8vMzJUZ1c4RUozZncKD6zE4MONozWBfQYn9HG31DW100o2oFpn6iACQAvCDyXkgSeuQtRFjPwCIW5q2Dltq7Srkc8b81/ZynC59uqkmDJefGyNPzTk3ilRl6wcLOhCP1TD7YtCtZ/7ZpoGpNMiDD6XhKnOmz10sBSy1SXt54+zFVcuQ1ITRi4E2WmiFRjTa8T+ZMwurW+F+iwOu6+z8/0sKQaG5SrKA74GI9D6iRQnqiPg2Abr97Vq7X2Fjvz2NqFjcB0dD29XijHcLCdXQ1DcI3gx94SdMmmfeU5ub2ArsH/4nA8XlS7YE7BirUihgHD4/KIr52dc+Fst6i7SBH433d/Y3Pmhi89FHY8+sGyPFXNG+SeLLHafcR6bLLGyk0iGa2bZaBqUGovYNojni8KSrLRPXTgCyeNAOS7Gpamwi1Xco7m7nEEmAv9vpEvtOUx83pGBOkgu3oSV0t3jmp+OUvcwMMQ='" -o main ./main.go
```
22 changes: 9 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ import (

"go.uber.org/zap"

"github.com/Arriven/db1000n/src/jobs"
"github.com/Arriven/db1000n/src/runner"
"github.com/Arriven/db1000n/src/runner/config"
"github.com/Arriven/db1000n/src/job"
"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils"
"github.com/Arriven/db1000n/src/utils/metrics"
"github.com/Arriven/db1000n/src/utils/ota"
Expand All @@ -50,8 +49,8 @@ func main() {
log.SetFlags(log.Ldate | log.Lmicroseconds | log.Lshortfile | log.LUTC)
log.Printf("DB1000n [Version: %s][PID=%d]\n", ota.Version, os.Getpid())

runnerConfigOptions := runner.NewConfigOptionsWithFlags()
jobsGlobalConfig := jobs.NewGlobalConfigWithFlags()
runnerConfigOptions := job.NewConfigOptionsWithFlags()
jobsGlobalConfig := job.NewGlobalConfigWithFlags()
otaConfig := ota.NewConfigWithFlags()
countryCheckerConfig := utils.NewCountryCheckerConfigWithFlags()
updaterMode, destinationPath := config.NewUpdaterOptionsWithFlags()
Expand Down Expand Up @@ -89,7 +88,7 @@ func main() {

metrics.InitOrFail(ctx, *prometheusOn, *prometheusPushGateways, jobsGlobalConfig.ClientID, country)

r, err := runner.New(runnerConfigOptions, jobsGlobalConfig)
r, err := job.NewRunner(runnerConfigOptions, jobsGlobalConfig)
if err != nil {
log.Panicf("Error initializing runner: %v", err)
}
Expand All @@ -107,11 +106,10 @@ func newZapLogger(debug bool) (*zap.Logger, error) {
}

func setUpPprof(pprof string, debug bool) {
if debug && pprof == "" {
switch {
case debug && pprof == "":
pprof = ":8080"
}

if pprof == "" {
case pprof == "":
return
}

Expand All @@ -122,9 +120,7 @@ func setUpPprof(pprof string, debug bool) {
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprofhttp.Symbol))
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprofhttp.Trace))

go func() {
log.Println(http.ListenAndServe(pprof, mux))
}()
go log.Println(http.ListenAndServe(pprof, mux))
}

func cancelOnSignal(cancel context.CancelFunc) {
Expand Down
19 changes: 4 additions & 15 deletions src/jobs/base.go → src/job/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

// Package jobs [contains all the attack types db1000n can simulate]
package jobs
// Package job [contains all the attack types db1000n can simulate]
package job

import (
"context"
Expand All @@ -31,12 +31,10 @@ import (
"github.com/google/uuid"
"go.uber.org/zap"

"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils"
)

// Args comment for linter
type Args = map[string]interface{}

// GlobalConfig passes commandline arguments to every job.
type GlobalConfig struct {
ClientID string
Expand Down Expand Up @@ -66,16 +64,7 @@ func NewGlobalConfigWithFlags() *GlobalConfig {
}

// Job comment for linter
type Job = func(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error)

// Config comment for linter
type Config struct {
Name string `mapstructure:"name"`
Type string `mapstructure:"type"`
Count int `mapstructure:"count"`
Filter string `mapstructure:"filter"`
Args Args `mapstructure:"args"`
}
type Job = func(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error)

// Get job by type name
//nolint:cyclop // The string map alternative is orders of magnitude slower
Expand Down
11 changes: 6 additions & 5 deletions src/jobs/complex.go → src/job/complex.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

package jobs
package job

import (
"context"
Expand All @@ -30,17 +30,18 @@ import (
"github.com/mitchellh/mapstructure"
"go.uber.org/zap"

"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils/templates"
)

func sequenceJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error) {
func sequenceJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

var jobConfig struct {
BasicJobConfig

Jobs []Config
Jobs []config.Config
}

if err := mapstructure.Decode(args, &jobConfig); err != nil {
Expand All @@ -64,14 +65,14 @@ func sequenceJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalCo
return nil, nil
}

func parallelJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error) {
func parallelJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

var jobConfig struct {
BasicJobConfig

Jobs []Config
Jobs []config.Config
}

if err := mapstructure.Decode(args, &jobConfig); err != nil {
Expand Down
35 changes: 23 additions & 12 deletions src/runner/config/config.go → src/job/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,35 @@ import (
"path/filepath"
"time"

"github.com/Arriven/db1000n/src/jobs"
"github.com/Arriven/db1000n/src/utils"
)

// Config for all jobs to run
// Args is a generic arguments map.
type Args = map[string]interface{}

// Config for a single job.
type Config struct {
Jobs []jobs.Config
Name string `mapstructure:"name"`
Type string `mapstructure:"type"`
Count int `mapstructure:"count"`
Filter string `mapstructure:"filter"`
Args Args `mapstructure:"args"`
}

// MultiConfig for all jobs.
type MultiConfig struct {
Jobs []Config
}

type RawConfig struct {
type RawMultiConfig struct {
Body []byte
Encrypted bool
lastModified string
etag string
}

// fetch tries to read a config from the list of mirrors until it succeeds
func fetch(paths []string, lastKnownConfig *RawConfig) *RawConfig {
func fetch(paths []string, lastKnownConfig *RawMultiConfig) *RawMultiConfig {
for i := range paths {
config, err := fetchSingle(paths[i], lastKnownConfig)
if err != nil {
Expand All @@ -69,7 +80,7 @@ func fetch(paths []string, lastKnownConfig *RawConfig) *RawConfig {
}

// fetchSingle reads a config from a single source
func fetchSingle(path string, lastKnownConfig *RawConfig) (*RawConfig, error) {
func fetchSingle(path string, lastKnownConfig *RawMultiConfig) (*RawMultiConfig, error) {
configURL, err := url.ParseRequestURI(path)
// absolute paths can be interpreted as a URL with no schema, need to check for that explicitly
if err != nil || filepath.IsAbs(path) {
Expand All @@ -78,7 +89,7 @@ func fetchSingle(path string, lastKnownConfig *RawConfig) (*RawConfig, error) {
return nil, err
}

return &RawConfig{Body: res, lastModified: "", etag: ""}, nil
return &RawMultiConfig{Body: res, lastModified: "", etag: ""}, nil
}

const requestTimeout = 20 * time.Second
Expand Down Expand Up @@ -117,11 +128,11 @@ func fetchSingle(path string, lastKnownConfig *RawConfig) (*RawConfig, error) {
return nil, err
}

return &RawConfig{Body: res, etag: etag, lastModified: lastModified}, nil
return &RawMultiConfig{Body: res, etag: etag, lastModified: lastModified}, nil
}

// FetchRawConfig retrieves the current config using a list of paths. Falls back to the last known config in case of errors.
func FetchRawConfig(paths []string, lastKnownConfig *RawConfig) *RawConfig {
// FetchRawMultiConfig retrieves the current config using a list of paths. Falls back to the last known config in case of errors.
func FetchRawMultiConfig(paths []string, lastKnownConfig *RawMultiConfig) *RawMultiConfig {
newConfig := fetch(paths, lastKnownConfig)

if utils.IsEncrypted(newConfig.Body) {
Expand All @@ -142,12 +153,12 @@ func FetchRawConfig(paths []string, lastKnownConfig *RawConfig) *RawConfig {
}

// Unmarshal config encoded with the given format.
func Unmarshal(body []byte, format string) *Config {
func Unmarshal(body []byte, format string) *MultiConfig {
if body == nil {
return nil
}

var config Config
var config MultiConfig

if err := utils.Unmarshal(body, &config, format); err != nil {
return nil
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/runner/config/updater.go → src/job/config/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ func NewUpdaterOptionsWithFlags() (updaterMode *bool, destinationPath *string) {
}

func UpdateLocal(destinationPath string, configPaths []string, backupConfig []byte) {
lastKnownConfig := &RawConfig{Body: backupConfig}
lastKnownConfig := &RawMultiConfig{Body: backupConfig}

for {
if rawConfig := FetchRawConfig(configPaths, lastKnownConfig); !bytes.Equal(lastKnownConfig.Body, rawConfig.Body) {
if rawConfig := FetchRawMultiConfig(configPaths, lastKnownConfig); !bytes.Equal(lastKnownConfig.Body, rawConfig.Body) {
if err := writeConfig(rawConfig.Body, destinationPath); err != nil {
log.Printf("Error writing config: %v", err)

Expand Down
7 changes: 4 additions & 3 deletions src/jobs/dnsblast.go → src/job/dnsblast.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

package jobs
package job

import (
"context"
Expand All @@ -32,6 +32,7 @@ import (
"go.uber.org/zap"

"github.com/Arriven/db1000n/src/core/dnsblast"
"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils"
)

Expand All @@ -43,7 +44,7 @@ type dnsBlastConfig struct {
ParallelQueries int `mapstructure:"parallel_queries"`
}

func dnsBlastJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error) {
func dnsBlastJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error) {
jobConfig, err := getDNSBlastConfig(args)
if err != nil {
return nil, err
Expand All @@ -65,7 +66,7 @@ func dnsBlastJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalCo
return nil, err
}

func getDNSBlastConfig(args Args) (*dnsBlastConfig, error) {
func getDNSBlastConfig(args config.Args) (*dnsBlastConfig, error) {
const (
defaultParallelQueriesPerCycle = 5
defaultIntervalMS = 10
Expand Down
9 changes: 5 additions & 4 deletions src/jobs/http.go → src/job/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

package jobs
package job

import (
"context"
Expand All @@ -33,6 +33,7 @@ import (
"go.uber.org/zap"

"github.com/Arriven/db1000n/src/core/http"
"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils"
"github.com/Arriven/db1000n/src/utils/metrics"
"github.com/Arriven/db1000n/src/utils/templates"
Expand All @@ -45,7 +46,7 @@ type httpJobConfig struct {
Client map[string]interface{} // See HTTPClientConfig
}

func singleRequestJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error) {
func singleRequestJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down Expand Up @@ -120,7 +121,7 @@ func cookieLoaderFunc(cookies map[string]string, logger *zap.Logger) func(key []
}
}

func fastHTTPJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args Args) (data interface{}, err error) {
func fastHTTPJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalConfig, args config.Args) (data interface{}, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down Expand Up @@ -168,7 +169,7 @@ func fastHTTPJob(ctx context.Context, logger *zap.Logger, globalConfig *GlobalCo
return nil, nil
}

func getHTTPJobConfigs(ctx context.Context, args Args, globalProxyURLs string, logger *zap.Logger) (
func getHTTPJobConfigs(ctx context.Context, args config.Args, globalProxyURLs string, logger *zap.Logger) (
cfg *httpJobConfig, clientCfg *http.ClientConfig, requestTpl *templates.MapStruct, err error,
) {
var jobConfig httpJobConfig
Expand Down
5 changes: 3 additions & 2 deletions src/jobs/packetgen.go → src/job/packetgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

package jobs
package job

import (
"context"
Expand All @@ -33,12 +33,13 @@ import (
"go.uber.org/zap"

"github.com/Arriven/db1000n/src/core/packetgen"
"github.com/Arriven/db1000n/src/job/config"
"github.com/Arriven/db1000n/src/utils"
"github.com/Arriven/db1000n/src/utils/metrics"
"github.com/Arriven/db1000n/src/utils/templates"
)

func packetgenJob(ctx context.Context, logger *zap.Logger, _ *GlobalConfig, args Args) (data interface{}, err error) {
func packetgenJob(ctx context.Context, logger *zap.Logger, _ *GlobalConfig, args config.Args) (data interface{}, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down
Loading

0 comments on commit 4ffefe8

Please sign in to comment.