# 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adaptix-framework.gitbook.io/adaptix-framework/extenders/listeners/gopher-tcp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
