contacts

package
v0.2.26 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package contacts is the chassis's `contacts` personality: a CardDAV server over the durable contacts store (chassis/contacts), mounted on the web head under a reserved path prefix (--contacts-path-prefix, default /carddav) on every hostname the head serves. It is a stateful personality: reads — PROPFIND, REPORT, GET — are answered from the store and never run a stack; a client mutation (PUT, DELETE, MKCOL, PROPPATCH) is governed by the address book's policy and may become one bounded envelope into the account tenant's `_contacts` stack (chassis/contacts.PolicyMode).

Materialize, then serve: stacks write cards with txco://contacts/*; the head serves them to Apple Contacts, Thunderbird and DAVx⁵. The server a client uses is the stack's own hostname — paris@<host> connects to https://<host>/carddav/. A client's bytes are stored and served as written (the head answers PUT, GET and multiget itself); the library serves the rest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller owns the head's shared state: the store, the verified-login cache, the throttles, the lanes. It binds no listener of its own — the web head mounts Handler().

func NewController

func NewController(ctx context.Context, pu *processor.Unit, store *chcon.Store, resolver HostResolver) *Controller

NewController constructs (but does not start) the head. A nil store (contacts personality off) yields an inert controller whose Handler answers 404 and whose Start is a no-op.

func (*Controller) Enabled

func (c *Controller) Enabled() bool

Enabled reports whether the head serves anything: the personality is on and the store opened.

func (*Controller) Handler

func (c *Controller) Handler() http.Handler

Handler is the http.Handler the web head mounts on Prefix()/ and /.well-known/carddav.

func (*Controller) Prefix

func (c *Controller) Prefix() string

Prefix is the reserved path prefix (no trailing slash).

func (*Controller) ServeHTTP

func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the whole request flow. Every branch that reads or writes the store is answered here or by the CardDAV library over backend.go; none of them touches the bus except through the lanes.

func (*Controller) Start

func (c *Controller) Start()

Start starts the lanes. The head itself is served by the web head, so a `contacts` personality without `web` serves nothing — say so.

func (*Controller) Stop

func (c *Controller) Stop()

Stop stops the lanes.

type HostResolver

type HostResolver interface {
	ResolveErr(key ingress.RouteKey) (ingress.RouteTarget, bool, error)
}

HostResolver maps a request's Host to its tenant — the same routing every web request uses (ingress.DBResolver.ResolveErr). Tests inject.

Jump to

Keyboard shortcuts

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