Documentation
¶
Overview ¶
Package bolthole makes any service reachable from anywhere through a relay it dials out to, with end-to-end encryption the relay cannot read.
Expose an http.Handler:
code := bolthole.LoadOrCreateCode("~/.config/myapp/bolthole.code")
a := bolthole.Expose("https://relay.example.com", code, myHandler)
fmt.Println("connect with:", must(a.ConnString()))
a.Run(ctx)
Reach it from another program:
c, _ := bolthole.Dial(connString)
resp, _ := c.HTTPClient().Get("http://agent/api/status")
The subpackages hold the pieces: agent, client, relay (the server), mux (multiplexed streams), e2e (codes and the encrypted channel).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Code ¶
Code is a connect code: the one secret that grants access to an agent.
func LoadOrCreateCode ¶
LoadOrCreateCode reads a code from path, creating it (mode 0600) if the file does not exist. A leading "~/" expands to the home directory.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent is the service side of the relay: it dials out to a relay, keeps that connection alive across failures, and dispatches incoming streams (plaintext or end-to-end encrypted) to handlers.
|
Package agent is the service side of the relay: it dials out to a relay, keeps that connection alive across failures, and dispatches incoming streams (plaintext or end-to-end encrypted) to handlers. |
|
Package client reaches an agent through a relay, or directly when it can, over an end-to-end encrypted session.
|
Package client reaches an agent through a relay, or directly when it can, over an end-to-end encrypted session. |
|
cmd
|
|
|
bolthole
command
Command bolthole is the relay server and a language-agnostic sidecar.
|
Command bolthole is the relay server and a language-agnostic sidecar. |
|
Package e2e implements connect codes, key derivation and the end-to-end encrypted channel between a client and an agent (spec §1 and §5).
|
Package e2e implements connect codes, key derivation and the end-to-end encrypted channel between a client and an agent (spec §1 and §5). |
|
examples
|
|
|
chat
command
A terminal chat room hosted on your laptop, joinable from anywhere.
|
A terminal chat room hosted on your laptop, joinable from anywhere. |
|
webhook-inbox
command
Receive webhooks (GitHub, Stripe, Slack…) on your laptop without a public server, tunnel or port forward.
|
Receive webhooks (GitHub, Stripe, Slack…) on your laptop without a public server, tunnel or port forward. |
|
kinds
|
|
|
httpkind
Package httpkind implements the `http` stream kind (spec §4.1): one HTTP exchange per stream, bodies streamed both ways.
|
Package httpkind implements the `http` stream kind (spec §4.1): one HTTP exchange per stream, bodies streamed both ways. |
|
wskind
Package wskind implements the `ws` stream kind (spec §4.2): WebSocket messages carried as length-prefixed records on a mux stream.
|
Package wskind implements the `ws` stream kind (spec §4.2): WebSocket messages carried as length-prefixed records on a mux stream. |
|
Package mux implements the relay stream multiplexer (spec §3): framed, flow-controlled, bidirectional byte streams over any message transport.
|
Package mux implements the relay stream multiplexer (spec §3): framed, flow-controlled, bidirectional byte streams over any message transport. |
|
Package relay is the reference relay: a small, stateless router that pairs agents (dialing out) with clients (dialing in) and forwards bytes.
|
Package relay is the reference relay: a small, stateless router that pairs agents (dialing out) with clients (dialing in) and forwards bytes. |