TXTTunnel is a simple HTTP-based service for creating, sending, retrieving, and deleting text-based tunnels. It uses SSE (Server-Sent Events) for real-time communication between the client(s) and the server. Data sent to tunnels can either be sent via POST requests or through URL parameters.
- Endpoint:
/
- Method:
GET
- Description: Displays the homepage of the TXTTunnel service.
- Response:
200 OK
with a welcome message.
- Endpoint:
/api/v3/tunnel/create
- Methods:
POST
,GET
- Description: Creates a new tunnel.
- Request (POST):
- Body: JSON object containing the
id
field.
{ "id": "tunnelId" }
- Body: JSON object containing the
- Request (GET):
- Query Parameters:
id
(optional): If not provided, a random ID will be generated.
- Query Parameters:
- Response:
200 OK
with a JSON object containing theid
of the created tunnel.
{ "id": "tunnelId" }
- Endpoint:
/api/v3/tunnel/stream
- Methods:
GET
,POST
- Description: Streams the content of a tunnel using Server-Sent Events (SSE).
- Request (GET):
- Query Parameters:
id
: The ID of the tunnel.subChannel
(optional): The subchannel to stream. Defaults tomain
.
- Query Parameters:
- Request (POST):
- Body: JSON object containing the
id
andsubChannel
fields.
{ "id": "tunnelId", "subChannel": "subChannelName" }
- Body: JSON object containing the
- Response:
200 OK
with SSE data.
- Endpoint:
/api/v3/tunnel/get
- Methods:
GET
,POST
- Description: Retrieves the content of a tunnel.
- Request (GET):
- Query Parameters:
id
: The ID of the tunnel.subChannel
(optional): The subchannel to retrieve. Defaults tomain
.
- Query Parameters:
- Request (POST):
- Body: JSON object containing the
id
andsubChannel
fields.
{ "id": "tunnelId", "subChannel": "subChannelName" }
- Body: JSON object containing the
- Response:
200 OK
with a JSON object containing thecontent
of the specified subchannel.
{ "content": "textData" }
- Endpoint:
/api/v3/tunnel/send
- Methods:
POST
,GET
- Description: Sends data to a tunnel.
- Request (POST):
- Body: JSON object containing the
id
,subChannel
, andcontent
fields.
{ "id": "tunnelId", "subChannel": "subChannelName", "content": "textData" }
- Body: JSON object containing the
- Request (GET):
- Query Parameters:
id
: The ID of the tunnel.subChannel
: The subchannel to send data to.content
: The content to send.
- Query Parameters:
- Response:
200 OK
if the data is successfully sent.
This project is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. For more information, see the LICENSE
file.