# akene-uzezi/tp architecture

> Architecture diagram of the GitHub repository akene-uzezi/tp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akene-uzezi/tp
- Repository: https://github.com/akene-uzezi/tp

## Overview

This Go TCP protocol provides a command-line client/server workflow: the client connects, sends a ping, receives a pong, then sends data; the server accepts connections, dispatches decoded message types, and returns pong or acknowledgment responses. The protocol package encodes and validates the binary wire format used by both sides. README capabilities such as versioning, payload limits, and graceful cancellation are represented where documented. Source evidence is limited to the indexed excerpts and README; no separate data-processing behavior is shown.

Main entry points: [`server/server.go`](https://github.com/akene-uzezi/tp/blob/main/server/server.go) (Connection handler), [`cmd/main.go`](https://github.com/akene-uzezi/tp/blob/main/cmd/main.go) (Mode dispatcher), [`client/client.go`](https://github.com/akene-uzezi/tp/blob/main/client/client.go) (TCP client), [`protocol/protocol.go`](https://github.com/akene-uzezi/tp/blob/main/protocol/protocol.go) (Message codec)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_cli["Mode dispatcher<br/>[main.go]"]
end

subgraph group_endpoints["TCP endpoints"]
  node_client["TCP client<br/>[client.go]"]
  node_server["Listener and handler<br/>[main.go]"]
  node_handler["Connection handler<br/>[server.go]"]
  node_processor["Data processing<br/>[server.go]"]
end

subgraph group_wire["Wire protocol"]
  node_protocol["Message codec<br/>[protocol.go]"]
end

node_user(("CLI user"))
node_tcp(("TCP peer"))

node_user -->|"selects mode"| node_cli
node_cli -->|"starts client"| node_client
node_cli -->|"starts listener"| node_server
node_server -->|"dispatches connection"| node_handler
node_client -->|"opens TCP"| node_tcp
node_server -->|"accepts connections"| node_tcp
node_client -->|"encodes and decodes"| node_protocol
node_handler -->|"decodes and encodes"| node_protocol
node_handler -->|"processes data"| node_processor
node_tcp -->|"provides connection"| node_handler

click node_cli "https://github.com/akene-uzezi/tp/blob/main/cmd/main.go"
click node_client "https://github.com/akene-uzezi/tp/blob/main/client/client.go"
click node_server "https://github.com/akene-uzezi/tp/blob/main/cmd/main.go"
click node_handler "https://github.com/akene-uzezi/tp/blob/main/server/server.go"
click node_processor "https://github.com/akene-uzezi/tp/blob/main/server/server.go"
click node_protocol "https://github.com/akene-uzezi/tp/blob/main/protocol/protocol.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_user toneBlue
class node_client,node_server,node_handler,node_processor toneAmber
class node_protocol toneMint
class node_tcp toneIndigo
```

## Components

### Application entry

- [Mode dispatcher](https://github.com/akene-uzezi/tp/blob/main/cmd/main.go): `cmd/main.go`

### TCP endpoints

- [TCP client](https://github.com/akene-uzezi/tp/blob/main/client/client.go): `client/client.go`
- [Listener and handler](https://github.com/akene-uzezi/tp/blob/main/cmd/main.go): `cmd/main.go`
- [Connection handler](https://github.com/akene-uzezi/tp/blob/main/server/server.go): `server/server.go`
- [Data processing](https://github.com/akene-uzezi/tp/blob/main/server/server.go): `server/server.go`

### Wire protocol

- [Message codec](https://github.com/akene-uzezi/tp/blob/main/protocol/protocol.go): `protocol/protocol.go`

### Other components

- **CLI user**
- **TCP peer**

## Connections

- CLI user → Mode dispatcher: selects mode (evidence: `cmd/main.go`)
- Mode dispatcher → TCP client: starts client (evidence: `cmd/main.go`)
- Mode dispatcher → Listener and handler: starts listener (evidence: `cmd/main.go`)
- Listener and handler → Connection handler: dispatches connection (evidence: `cmd/main.go`)
- TCP client → TCP peer: opens TCP (evidence: `client/client.go`)
- Listener and handler → TCP peer: accepts connections (evidence: `cmd/main.go`)
- TCP client → Message codec: encodes and decodes (evidence: `client/client.go`)
- Connection handler → Message codec: decodes and encodes (evidence: `server/server.go`)
- Connection handler → Data processing: processes data (evidence: `server/server.go`)
- TCP peer → Connection handler: provides connection
