<commit_before>package anonymous_messaging

import (
	"fmt"
	packet_format "anonymous-messaging/packet_format"
)

type Mix struct {
	Id string
	PubKey int
	PrvKey int
}


func (m Mix) ProcessPacket(p packet_format.Packet, c chan<- packet_format.Packet){
	fmt.Println("> Processing packet")

	dePacket := p
	c <- dePacket
}

func (m Mix) SendLoopMessage() {
	fmt.Println("> Sending loop message")
}

func NewMix(id string, pubKey, prvKey int ) Mix{
	return Mix{Id:id, PubKey:pubKey, PrvKey:prvKey}
}<commit_msg>Added delay of the packets by mix<commit_after>package anonymous_messaging

import (
	"fmt"
	packet_format "anonymous-messaging/packet_format"
	"time"
)

type Mix struct {
	Id string
	PubKey int
	PrvKey int
}


func (m Mix) ProcessPacket(p packet_format.Packet, c chan<- packet_format.Packet){
	fmt.Println("> Processing packet")

	dePacket := p
	timeoutCh := make(chan packet_format.Packet, 1)

	go func(p packet_format.Packet, delay float64) {
		time.Sleep(time.Second * time.Duration(delay))
		timeoutCh <- p
	}(dePacket, dePacket.Delays[0])

	c <- <- timeoutCh
}

func (m Mix) SendLoopMessage() {
	fmt.Println("> Sending loop message")
}

func NewMix(id string, pubKey, prvKey int ) Mix{
	return Mix{Id:id, PubKey:pubKey, PrvKey:prvKey}
}
{'fraction_non_alphanumeric': 0.11980830670926518, 'fraction_numerical': 0.003194888178913738, 'mean_word_length': 4.855140186915888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6662987', 'n_tokens_mistral': 475, 'n_tokens_neox': 450, 'n_words': 120}