<commit_before>TLJ
===

A simple Type Length Value protocol implemented with JSON to hand structs between Go applications in an event driven and parallel way.

Concepts
--------

TLJ is used to write networked application in Go by expressing the applications behavior in terms of what to do with structs recieved on various sockets.

Here's a rough idea how how TLJ came about:

* maybe "*sockets that have a remote certificate I trust are 'trusted' sockets*"
* or "*sockets that send an `Authentication{}` struct with a valid password are 'trusted' sockets*"
* and "*when 'trusted' sockets send a `Message{}`, save it in the data base*"
* but also "*when 'trusted' sockets send a `Message{}`, print it*"
* how could this be expressed easily and sent efficiently?

Most generally, when *tag* receives *type*, do *func*.  If there are many funcs with the same criteria, run them all in parallel as goroutines.

This library is meant to be used on a variety of networks, from traditional TLS sockets on the internet to anonymity networks such as I2P.

Usage
-----

To use TLJ, start by defining some structs you want to pass around.  We want to hold on to references to their types for later.  These structs are just basic examples, anything that can be marshalled to JSON is ok.

```go
type ExampleEvent struct {
	Parameter1	string
	Parameter2	int
}
example_event_inst := reflect.TypeOf(ExampleEvent{})
example_event_ptr := reflect.TypeOf(&ExampleEvent{})

Type ExampleRequest {
	Parameter1	string
}
example_request_inst := reflect.TypeOf(ExampleRequest{})
example_request_ptr := reflect.TypeOf(&ExampleRequest{})

type ExampleResponse {
	Parameter1	string
	Parameter2	string
	Parameter3	string
}
example_response_inst := reflect.TypeOf(ExampleResponse{})
example_response_ptr := reflect.TypeOf(&ExampleResponse{})
```<commit_msg>fix readme<commit_after>TLJ
===

A simple Type Length Value protocol implemented with JSON to hand structs between Go applications in an event driven and parallel way.

Concepts
--------

TLJ is used to write networked application in Go by expressing the application's behavior in terms of what to do with structs recieved on various sockets.

Here's a rough idea of how TLJ came about:

* maybe "*sockets that have a remote certificate I trust are 'trusted' sockets*"
* or "*sockets that send an `Authentication{}` struct with a valid password are 'trusted' sockets*"
* and "*when 'trusted' sockets send a `Message{}`, save it in the database*"
* and also "*when 'trusted' sockets send a `Message{}`, print it*"
* how could this be expressed easily?

Most generally, when *tag* receives *type*, do *func*.  If there are many funcs with the same criteria, run them all in parallel as goroutines.  This library is meant to be used on a variety of networks, from traditional TLS sockets on the internet to anonymity networks such as I2P.

Usage
-----

To use TLJ, start by defining some structs you want to pass around.  We want to hold on to references to their types for later.  These structs are just basic examples, anything that can be marshalled to JSON is ok.

```go
type ExampleEvent struct {
	Parameter1	string
	Parameter2	int
}
example_event_inst := reflect.TypeOf(ExampleEvent{})
example_event_ptr := reflect.TypeOf(&ExampleEvent{})

Type ExampleRequest {
	Parameter1	string
}
example_request_inst := reflect.TypeOf(ExampleRequest{})
example_request_ptr := reflect.TypeOf(&ExampleRequest{})

type ExampleResponse {
	Parameter1	string
	Parameter2	string
	Parameter3	string
}
example_response_inst := reflect.TypeOf(ExampleResponse{})
example_response_ptr := reflect.TypeOf(&ExampleResponse{})
```
{'fraction_non_alphanumeric': 0.07844756399669695, 'fraction_numerical': 0.0038535645472061657, 'mean_word_length': 4.937908496732026, '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': '5842969', 'n_tokens_mistral': 986, 'n_tokens_neox': 954, 'n_words': 475}