<commit_before>package checks

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"os"
	"strings"

	"github.com/jonog/redalert/utils"

	"golang.org/x/crypto/ssh"
	"golang.org/x/crypto/ssh/agent"
)

func init() {
	Register("remote-docker", NewDockerRemoteDocker)
}

type RemoteDocker struct {
	User     string
	Password string
	Host     string
	Key      string
	Tool     string
	log      *log.Logger
}

type RemoteDockerConfig struct {
	User     string `json:"user"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Key      string `json:"host"`
	Tool     string `json:"tool"`
}

var NewDockerRemoteDocker = func(config Config, logger *log.Logger) (Checker, error) {

	var remoteDockerConfig RemoteDockerConfig
	err := json.Unmarshal([]byte(config.Config), &remoteDockerConfig)
	if err != nil {
		return nil, err
	}

	tool := utils.StringDefault(remoteDockerConfig.Tool, "nc")
	if !utils.FindStringInArray(tool, []string{"nc", "socat"}) {
		return nil, errors.New("checks: unknown tool in remote docker config")
	}

	if remoteDockerConfig.User == "" {
		return nil, errors.New("remote-docker: user cannot be blank")
	}

	if remoteDockerConfig.Host == "" {
		return nil, errors.New("remote-docker: host cannot be blank")
	}

	return Checker(&RemoteDocker{
		User:     remoteDockerConfig.User,
		Password: remoteDockerConfig.Password,<commit_msg>Fix remote-docker json<commit_after>package checks

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"os"
	"strings"

	"github.com/jonog/redalert/utils"

	"golang.org/x/crypto/ssh"
	"golang.org/x/crypto/ssh/agent"
)

func init() {
	Register("remote-docker", NewDockerRemoteDocker)
}

type RemoteDocker struct {
	User     string
	Password string
	Host     string
	Key      string
	Tool     string
	log      *log.Logger
}

type RemoteDockerConfig struct {
	User     string `json:"user"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Key      string `json:"key"`
	Tool     string `json:"tool"`
}

var NewDockerRemoteDocker = func(config Config, logger *log.Logger) (Checker, error) {

	var remoteDockerConfig RemoteDockerConfig
	err := json.Unmarshal([]byte(config.Config), &remoteDockerConfig)
	if err != nil {
		return nil, err
	}

	tool := utils.StringDefault(remoteDockerConfig.Tool, "nc")
	if !utils.FindStringInArray(tool, []string{"nc", "socat"}) {
		return nil, errors.New("checks: unknown tool in remote docker config")
	}

	if remoteDockerConfig.User == "" {
		return nil, errors.New("remote-docker: user cannot be blank")
	}

	if remoteDockerConfig.Host == "" {
		return nil, errors.New("remote-docker: host cannot be blank")
	}

	return Checker(&RemoteDocker{
		User:     remoteDockerConfig.User,
		Password: remoteDockerConfig.Password,
{'fraction_non_alphanumeric': 0.13163558106169296, 'fraction_numerical': 0.0, 'mean_word_length': 4.108058608058608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '625231', 'n_tokens_mistral': 1000, 'n_tokens_neox': 950, 'n_words': 229}