Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ Module path: `github.com/tphakala/et-go`. Go version: see `go.mod`.

## Layout

| Path | Role |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmd/et` | Entry point and flag parsing. |
| `internal/bootstrap` | Runs the system ssh to start etterminal; validates the config, parses the IDPASSKEY credentials it prints and redacts the passkey. |
| `internal/etcp` | Reliable, ordered, encrypted packet connection over replaceable TCP links: replay ring, recover exchange, liveness probes, reconnect backoff, write backpressure. |
| `internal/etservertest` | Test-only fake etserver (written independently from upstream semantics) and an in-memory `net.Pipe` network with cut and refuse controls, for synctest-driven etcp tests. |
| `internal/protocol` | Wire messages generated from upstream's `.proto` files (opaque API), plus `Header`, `Version` and `Packet`. Regenerate with `go generate ./internal/protocol` (needs protoc 3.21.12). |
| `internal/seal` | One direction of the libsodium-compatible encrypted stream: secretbox with a counter nonce. |
| `internal/wire` | Handshake message framing, stream frame framing, packet layout and size limits. |
| `rules/` | ruleguard matchers used by golangci-lint (build tag `ruleguard`). |
| Path | Role |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cmd/et` | Entry point and flag parsing. |
| `internal/bootstrap` | Runs the system ssh to start etterminal; validates the config, parses the IDPASSKEY credentials it prints and redacts the passkey. |
| `internal/console` | Local console in raw mode per platform: raw VT input as UTF-8, output, window size and resize events, and a Close that unblocks a pending Read. Windows uses UTF-16 carry codecs shared with every platform's tests. |
| `internal/etcp` | Reliable, ordered, encrypted packet connection over replaceable TCP links: replay ring, recover exchange, liveness probes, reconnect backoff, write backpressure. |
| `internal/etservertest` | Test-only fake etserver (written independently from upstream semantics) and an in-memory `net.Pipe` network with cut and refuse controls, for synctest-driven etcp tests. |
| `internal/protocol` | Wire messages generated from upstream's `.proto` files (opaque API), plus `Header`, `Version` and `Packet`. Regenerate with `go generate ./internal/protocol` (needs protoc 3.21.12). |
| `internal/seal` | One direction of the libsodium-compatible encrypted stream: secretbox with a counter nonce. |
| `internal/wire` | Handshake message framing, stream frame framing, packet layout and size limits. |
| `rules/` | ruleguard matchers used by golangci-lint (build tag `ruleguard`). |

Update this table when a package is added.

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ go 1.27.0
require (
github.com/quasilyte/go-ruleguard/dsl v0.3.23
golang.org/x/crypto v0.57.0
golang.org/x/sys v0.48.0
golang.org/x/term v0.46.0
google.golang.org/protobuf v1.36.12
)

require (
golang.org/x/mod v0.41.0 // indirect
golang.org/x/sync v0.23.0 // indirect
golang.org/x/sys v0.48.0 // indirect
golang.org/x/tools v0.50.0 // indirect
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU=
golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
Expand Down
22 changes: 22 additions & 0 deletions internal/console/console.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Package console is the local console or terminal that et puts into raw mode:
// raw VT input as UTF-8 bytes, remote output written back, the window size,
// and resize events. Each platform implements the same concrete Console type
// (console_unix.go, console_windows.go).
//
// On Unix, et must run as the foreground job of its controlling terminal.
// A background job that reads or changes the terminal is stopped by job
// control (SIGTTIN, SIGTTOU) until it is brought to the foreground.
package console

import "errors"

// Size is the terminal size in character cells, plus pixels when the
// platform reports them (0 otherwise).
type Size struct {
Rows, Cols int
Width, Height int
}

// ErrNotTerminal is returned by Open when stdin or stdout is not a terminal,
// or when the process has no controlling terminal to open.
var ErrNotTerminal = errors.New("console: stdin or stdout is not a terminal")
Loading
Loading