Documentation
¶
Overview ¶
Package aidproxy implements the AID Resource Addressing Gateway.
It exposes an Handler that translates
http://127.0.0.1:2121/aid/{address}/{path...}
URLs into outbound connections to the named AID, streaming raw HTTP/1.1 over the transport layer (QUIC stream for remote AIDs, direct TCP for locally registered agents).
The handler is mounted at /aid/ outside the daemon's main middleware chain so that arbitrary Content-Types and large request bodies are supported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain []Resolver
Chain tries each Resolver in order, returning the first successful result.
type Dialer ¶
type Dialer interface {
Dial(ctx context.Context, remote a2al.Address) (io.ReadWriteCloser, error)
}
Dialer opens a bidirectional stream to a remote AID.
The returned io.ReadWriteCloser carries raw HTTP/1.1 bytes:
- For remote AIDs: a QUIC stream through the Tangled Network.
- For locally registered AIDs: a direct TCP connection to service_tcp.
The caller is responsible for closing the returned stream.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the AID Resource Addressing Gateway http.Handler.
It parses the AID address from the URL path, resolves it, dials a stream to the remote AID, and bidirectionally proxies the raw HTTP/1.1 exchange.
func New ¶
New creates a Handler with the given resolver, dialer, and logger. If log is nil, slog.Default is used.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles requests of the form /aid/{address}[/{path}[?{query}]].
URL structure:
/aid/{address}[/{path}[?{query}]]
{address} is resolved via the Resolver chain to an a2al.Address. The request is then forwarded over the stream with its original method, headers, and body. The response is streamed back verbatim.
type RawAIDResolver ¶
type RawAIDResolver struct{}
RawAIDResolver resolves raw AID strings (the primary Phase 1 resolver). Later phases add DNS TXT bridging and DHT name resolution as additional links in a Chain.