> For the complete documentation index, see [llms.txt](https://adaptix-framework.gitbook.io/adaptix-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adaptix-framework.gitbook.io/adaptix-framework/extenders/listeners/gopher-tcp.md).

# Gopher TCP

"Gopher TCP" listener starts a tcp/mtls server and registers a "gopher" agent.

<figure><img src="/files/HZruSODhud7unaxoQNoz" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="187">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Host &#x26; port (Bind)</strong></td><td><strong>Required.</strong> The interface address and port to which your TCP Gopher server will bind.</td></tr><tr><td><strong>Callback addresses</strong></td><td><strong>Required.</strong> List of address:port to which the agent will send requests. Current server rotation strategy: round-robin.</td></tr><tr><td><strong>Timeout (sec)</strong></td><td>The time to wait between connections in the event of a connection failure or interruption</td></tr><tr><td><strong>TCP banner</strong></td><td>Data that the server will send when any client connects to the port</td></tr><tr><td><strong>Error answer</strong></td><td>Server response if agent is not registered</td></tr><tr><td><strong>Encryption key</strong></td><td>Communication channel encryption key</td></tr><tr><td><strong>Use mTLS</strong></td><td>If set, use mTLS. Certificates and keys are not generated on the server</td></tr></tbody></table>

**How to Generate Certificates and Keys for mTLS**

```bash
# CA cert
openssl genrsa -out ca.key 2048
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt -subj "/CN=Test CA"

# server cert and key
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -subj "/CN=localhost"
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 365 -sha256

# client cert and key
openssl genrsa -out client.key 2048
openssl req -new -key client.key -out client.csr -subj "/CN=client"
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 365 -sha256
```
