Files
2024-12-24 15:14:23 +01:00

62 lines
2.5 KiB
Markdown

# tbin
tbin is a simple pastebin application that allows you to store and share text snippets from your terminal.
## Prerequisites
Before building and starting tbin, ensure that you have the following software installed on your system:
- Docker
- Go (if you want to build the application from source)
## Building from source
To build tbin from source, follow these steps:
1. Clone the tbin repository: `git clone https://git.rznet.fr/tchivert/tbin`
2. Change into the project directory: `cd tbin`
3. Build the application using Go: `go build -o tbin`
4. The `tbin` binary will be generated in the project directory.
## Starting tbin with Docker
tbin can also be started using Docker. To do this, follow these steps:
1. Make sure you have Docker installed and running on your machine.
2. Clone the tbin repository: `git clone https://git.rznet.fr/tchivert/tbin`
3. Change into the project directory: `cd tbin`
4. Start the application using Docker Compose: `docker-compose up -d`
5. tbin will be started as a Docker container and will be accessible via telnet and HTTP.
## Usage
To submit a text snippet using the telnet interface, follow these steps:
1. Open a terminal session.
2. Use the `nc` command to connect to the tbin server: `echo "Your text snippet" | nc localhost 4242`
3. The server will generate a unique URL for your text snippet, which will be displayed in the terminal.
Purges can be trigged with the `/purge` endpoint.
It will remove all snippets olders than the configuered TTL (default: 48 hours).
## Configuration
tbin can be configured using command-line flags when starting the application.
- `--host`: Host address to listen on (default: 0.0.0.0).
- `--port`: Port number to listen on for telnet connections (default: 4242).
- `--http-port`: Port number to listen on for HTTP connections (default: 8080).
- `--http-url`: Base URL to send back to the client (default: http://localhost:8080/).
- `--dir`: Directory to store snippets (default: ./data).
- `--ttl`: Time-to-live in hours for the snippets (default: 48).
- `--buff`: Buffer size in MB for handling incoming data (default: 8).
- `--chunk`: Chunk size in bytes for reading data (default: 8192).
- `--conn-time`: Connection timeout in seconds (default: 10).
- `--read-time`: Read timeout in seconds (default: 2).
- `--verbose`: Enable verbose logging (default: false).
- `--plaintext`: Only allow plaintext snippets (default: false).
## License
tbin is licensed under the MIT License. See the [LICENSE](https://git.rznet.fr/tchivert/tbin/src/branch/main/LICENSE) file for more information.