triangle

package module
v0.0.0-...-e9a3055 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 3 Imported by: 0

README

Triangle

Yet another Hastebin alternative... in Go.

CLI Ingest

You can create pastes directly from stdin:

<command> | nc etc.fstab.me 9999
<command> | curl --data-binary @- https://etc.fstab.me

Both return a paste URL.

Encryption At Rest

Triangle can encrypt stored paste files using AES-256-GCM.

Add this to config.toml:

[filesystem]
root_path = "data"
encryption_key = "<base64 32-byte key>"

Generate a key with openssl:

openssl rand -base64 32

When encryption is enabled:

  • New paste files are stored encrypted.
  • Existing plaintext files are still readable.

License

triangle is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmbeddedUI embed.FS

EmbeddedUI contains the built frontend bundle. Run `bun --bun run build` inside `ui/` before building the Go binary.

Functions

This section is empty.

Types

type Config

type Config struct {
	Http       HttpConfig       `toml:"http"`
	Netcat     NetcatConfig     `toml:"netcat"`
	Filesystem FilesystemConfig `toml:"filesystem"`
	Paste      PasteConfig      `toml:"paste"`
}

func ParseConfig

func ParseConfig(p string) (Config, error)

type FilesystemConfig

type FilesystemConfig struct {
	RootPath      string `toml:"root_path"`
	EncryptionKey string `toml:"encryption_key"`
}

type HttpConfig

type HttpConfig struct {
	Address   string `toml:"address"`
	PublicURL string `toml:"public_url"`
}

type NetcatConfig

type NetcatConfig struct {
	Address     string `toml:"address"`
	ReadTimeout string `toml:"read_timeout"`

	// Legacy keys kept for backward compatibility with old config files.
	LegacyAddress     string `toml:"netcat_address"`
	LegacyReadTimeout string `toml:"netcat_read_timeout"`
}

type Paste

type Paste struct {
	ID        string     `json:"id"`
	Title     string     `json:"title"`
	Content   string     `json:"content"`
	Encrypted bool       `json:"encrypted"`
	Salt      string     `json:"salt,omitempty"`
	CreatedAt time.Time  `json:"created_at"`
	ExpiresAt *time.Time `json:"expires_at,omitempty"`
}

type PasteConfig

type PasteConfig struct {
	MinContentLength int `toml:"min_content_length"`
	MaxContentLength int `toml:"max_content_length"`
	MaxTitleLength   int `toml:"max_title_length"`
	IDLength         int `toml:"id_length"`
}

Directories

Path Synopsis
cmd
triangle command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL