<commit_before>// MsgBox Binary
//
// This is the main binary for running MsgBox.
//
// It reads in a config file at runtime and spawns:
//    - Relay
//    - Submission Agent
//    - (n) Incoming Workers
//    - (n) Outgoing Workers
//
package main

import (
	"fmt"
	"github.com/hgfischer/goconf"
	"github.com/msgbox/relay"
	"github.com/msgbox/submission-agent"
	"github.com/msgbox/workers"
)

func main() {

	// Read Config File
	c, err := conf.ReadConfigFile("msgbox.conf")
	if err != nil {
		// Handle Error
	}

	// Startup Relay
	relay_external_port, _ := c.GetString("", "relay-external-port")
	relay_internal_port, _ := c.GetString("", "relay-internal-port")

	go bindIncoming(string(relay_external_port))
	go bindOutgoing(string(relay_internal_port))

	// Start Workers
	incoming_workers, _ := c.GetInt("", "incoming-workers")
	outgoing_workers, _ := c.GetInt("", "outgoing-workers")

	for i := 0; i < incoming_workers; i++ {
		createIncomingWorker(string(i))
	}

	for i := 0; i < outgoing_workers; i++ {
		createOutgoingWorker(string(i), relay_internal_port)
	}

	// Start Submission Agent
	submission_agent_port, _ := c.GetString("", "submission-port")
	createSubmissionAgent(submission_agent_port)

	for {
	}
}

func bindIncoming(port string) {
	inLn := relay.ListenIncoming(port)
	defer inLn.Close()
}

func bindOutgoing(port string) {
	outLn := relay.ListenOutgoing(port)
	defer outLn.Close()
}

func createIncomingWorker(tag string) {
	fmt.Println("Creating an Incoming Worker")
	workers.CreateIncoming(tag)
}

func createOutgoingWorker(tag string, port string) {
	fmt.Println("Creating an Outgoing Worker")
	workers.CreateOutgoing(tag, port)
}
<commit_msg>set which function get called in go routines<commit_after>// MsgBox Binary
//
// This is the main binary for running MsgBox.
//
// It reads in a config file at runtime and spawns:
//    - Relay
//    - Submission Agent
//    - (n) Incoming Workers
//    - (n) Outgoing Workers
//
package main

import (
	"github.com/hgfischer/goconf"
	"github.com/msgbox/relay"
	"github.com/msgbox/submission-agent"
	"github.com/msgbox/workers"
)

func main() {

	// Read Config File
	c, err := conf.ReadConfigFile("msgbox.conf")
	if err != nil {
		// Handle Error
	}

	// Startup Relay
	relay_external_port, _ := c.GetString("", "relay-external-port")
	relay_internal_port, _ := c.GetString("", "relay-internal-port")

	bindIncoming(string(relay_external_port))
	bindOutgoing(string(relay_internal_port))

	// Start Workers
	incoming_workers, _ := c.GetInt("", "incoming-workers")
	outgoing_workers, _ := c.GetInt("", "outgoing-workers")

	for i := 0; i < incoming_workers; i++ {
		createIncomingWorker(string(i))
	}

	for i := 0; i < outgoing_workers; i++ {
		createOutgoingWorker(string(i), relay_internal_port)
	}

	// Start Submission Agent
	submission_agent_port, _ := c.GetString("", "submission-port")
	createSubmissionAgent(submission_agent_port)
}

func bindIncoming(port string) {
	go relay.ListenIncoming(port)
}

func bindOutgoing(port string) {
	go relay.ListenOutgoing(port)
}

func createIncomingWorker(tag string) {
	go workers.CreateIncoming(tag)
}

func createOutgoingWorker(tag string, port string) {
	go workers.CreateOutgoing(tag, port)
}

{'fraction_non_alphanumeric': 0.13934681181959566, 'fraction_numerical': 0.001244167962674961, 'mean_word_length': 4.220779220779221, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5113383', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1145, 'n_words': 247}