<commit_before>package main

import (
	"bufio"
	"crypto/tls"
	"flag"
	"fmt"
	"net"
	"os"
)

const (
	SelfCert       = ``
	SelfPrivateKey = ""
)

var (
	listenPort        = flag.Int("l", 65536, "The port to listen")
	certificationFile = flag.String("c", "", "Certification file")
	privateKeyFile    = flag.String("k", "", "Private Key file")
)

func main() {
	flag.Parse()
	if *listenPort < 65536 && 0 < *listenPort {
		ServerMode()
	} else {
		ClientMode()
	}
}

func ClientMode() {

	if len(os.Args) < 3 {
		fmt.Printf("Args not enough")
		os.Exit(2)
	}

	addr := os.Args[1]
	port := os.Args[2]

	conn, err := tls.Dial("tcp", fmt.Sprintf("%s:%s", addr, port), &tls.Config{})
	if err != nil {
		fmt.Printf("Can not connect to %s:%s due to %s", addr, port, err)
		os.Exit(1)
	}
	go func() {
		scanner := bufio.NewScanner(os.Stdin)
		for scanner.Scan() {
			buf := scanner.Bytes()
			buf = append(buf, []byte("\n")...)
			conn.Write(buf)
		}
		if err := scanner.Err(); err != nil {
			fmt.Printf("Scanner end:%s\n", err)
		}
	}()
	for {
		b := make([]byte, 2048)
		n, _ := conn.Read(b)
		if n != 0 {
			fmt.Print(string(b))
		} else {
			break
		}
	}
}

func ServerMode() {
	var (<commit_msg>update args and verbose<commit_after>package main

import (
	"bufio"
	"crypto/tls"
	"flag"
	"fmt"
	"net"
	"os"
)

const (
	SelfCert       = ``
	SelfPrivateKey = ""
)

var (
	listenPort        = flag.Int("l", 65536, "The port to listen")
	certificationFile = flag.String("c", "", "Certification file")
	privateKeyFile    = flag.String("k", "", "Private Key file")
	verbose           = flag.Bool("v", false, "Verbose Output")
)

func main() {
	flag.Parse()
	if *listenPort < 65536 && 0 < *listenPort {
		ServerMode()
	} else {
		ClientMode()
	}
}

func ClientMode() {

	args := flag.Args()
	if len(args) < 2 {
		fmt.Printf("Not enough for address and port, only get %s", args)
		os.Exit(2)
	}
	addr := args[0]
	port := args[1]
	if *verbose {
		fmt.Printf("Connecting %s:%s\n", addr, port)
	}

	conn, err := tls.Dial("tcp", fmt.Sprintf("%s:%s", addr, port), &tls.Config{})
	if err != nil {
		fmt.Printf("Can not connect to %s:%s due to %s", addr, port, err)
		panic(err)
	}
	go func() {
		scanner := bufio.NewScanner(os.Stdin)
		for scanner.Scan() {
			buf := scanner.Bytes()
			buf = append(buf, []byte("\n")...)
			if *verbose {
				fmt.Printf("Sending: %x\n", buf)
			}
			conn.Write(buf)
		}
		if err := scanner.Err(); err != nil {
			fmt.Printf("Scanner end:%s\n", err)
		}
	}()
	for {
		b := make([]byte, 2048)
		n, _ := conn.Read(b)
		if n != 0 {
			fmt.Print(string(b))
		} else {
			break
		}
	}
}

func ServerMode() {
	var (
{'fraction_non_alphanumeric': 0.19992369324685236, 'fraction_numerical': 0.01564288439526898, 'mean_word_length': 2.9848024316109423, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2669314', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1066, 'n_words': 248}