<commit_before>package stela

import (
	"bytes"
	"crypto/rand"
	"encoding/gob"
	"fmt"
	"net"
	"sync"
	"time"

	"github.com/miekg/dns"
)

const (
	// Version of stela
	Version = "1.0.0"

	// DefaultStelaAddress by default stela assumes there is a local instance running
	DefaultStelaAddress = "127.0.0.1:31000"

	// DefaultStelaPort by default stela assumes there is a local instance running
	DefaultStelaPort = 31000

	// DefaultMulticastAddress is the multicast IPV6 address stela communicates on
	DefaultMulticastAddress = "[fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b]"

	// DefaultMulticastPort is the default multicast port
	DefaultMulticastPort = 31053

	// ServiceName is how stela instances are registered as services
	ServiceName = "stela.services.fg"
)

// Actions for Service
const (
	RegisterAction   = iota
	DeregisterAction = iota
)

// Service used in request/response
type Service struct {
	Name     string
	Hostname string
	// Address      string // Automatically set from host:port when service is registered
	IPv4         string
	IPv6         string
	Port         int32
	Priority     int32
	Timeout      int32 // The length of time, in milliseconds, before a service is deregistered
	Action       int32
	Client       *Client // Store reference to the client that registered the service
	Value        interface{}
	id           string // Automatically set when the service is registered
	registerCh   chan struct{}
	deregisterCh chan struct{}
	stopped      bool
	mu           *sync.Mutex // protects registerCh, deregisterCh, stopped
}

// init service chans
// func (s *Service) init() {
// 	if s.mu == nil {
// 		s.mu = &sync.Mutex{}
// 	}
// }

// Equal tests if a Service is the same
func (s Service) Equal(testService *Service) bool {
	// if s.id != testService.id {
	// 	return false
	// }
	if s.Name != testService.Name {
		return false
	}
	if s.Hostname != testService.Hostname {
		return false
	}
	if s.IPv4 != testService.IPv4 {
		return false<commit_msg>Adding Stringer method to stela.Service<commit_after>package stela

import (
	"bytes"
	"crypto/rand"
	"encoding/gob"
	"fmt"
	"net"
	"sync"
	"time"

	"github.com/miekg/dns"
)

const (
	// Version of stela
	Version = "1.0.0"

	// DefaultStelaAddress by default stela assumes there is a local instance running
	DefaultStelaAddress = "127.0.0.1:31000"

	// DefaultStelaPort by default stela assumes there is a local instance running
	DefaultStelaPort = 31000

	// DefaultMulticastAddress is the multicast IPV6 address stela communicates on
	DefaultMulticastAddress = "[ff12::9000]"

	// DefaultMulticastPort is the default multicast port
	DefaultMulticastPort = 31053

	// ServiceName is how stela instances are registered as services
	ServiceName = "stela.services.fg"
)

// Actions for Service
const (
	RegisterAction   = iota
	DeregisterAction = iota
)

// Service used in request/response
type Service struct {
	Name     string
	Hostname string
	// Address      string // Automatically set from host:port when service is registered
	IPv4         string
	IPv6         string
	Port         int32
	Priority     int32
	Timeout      int32 // The length of time, in milliseconds, before a service is deregistered
	Action       int32
	Client       *Client // Store reference to the client that registered the service
	Value        interface{}
	id           string // Automatically set when the service is registered
	registerCh   chan struct{}
	deregisterCh chan struct{}
	stopped      bool
	mu           *sync.Mutex // protects registerCh, deregisterCh, stopped
}

// Stringer
func (s Service) String() string {
	return fmt.Sprintf("Name: %s, Hostname: %s, IPv4: %s, IPv6: %s, Port: %d, Action: %d", s.Name, s.Hostname, s.IPv4, s.IPv6, s.Port, s.Action)
}

// Equal tests if a Service is the same
func (s Service) Equal(testService *Service) bool {
	// if s.id != testService.id {
	// 	return false
	// }
	if s.Name != testService.Name {
		return false
	}
	if s.Hostname != testService.Hostname {
		return false
	}
	if s.IPv4 != testService.IPv4 {
		return false
{'fraction_non_alphanumeric': 0.0887456618740704, 'fraction_numerical': 0.025532969757064948, 'mean_word_length': 3.0634441087613293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6007996', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1282, 'n_words': 430}