Documentation
¶
Overview ¶
Package sites maps members' custom domains onto their homepage (the public_html that is also served at /~name).
How it works without a custom Caddy module:
- The DB (store.domains) is the source of truth for domain→user.
- A symlink farm at <data>/domains/<domain> -> <data>/users/<name>/public_html lets Caddy serve any mapped domain with `root * <data>/domains/{host}`.
- AskHandler answers Caddy's on-demand-TLS query so certificates are only issued for domains that are actually mapped (no open cert relay).
A member points DNS (CNAME or A) at the BBS host; the moment a TLS handshake for that domain arrives, Caddy asks us, gets a 200, provisions a cert, and serves their homepage. See docs/custom-domains.md.
Index ¶
- Variables
- func Normalize(d string) string
- func Valid(d string) bool
- type Manager
- func (m *Manager) Add(domain, username string) (string, error)
- func (m *Manager) AskHandler() http.Handler
- func (m *Manager) List(username string) ([]string, error)
- func (m *Manager) Remove(domain, username string) (string, error)
- func (m *Manager) ServeAsk(addr string) error
- func (m *Manager) Sync() error
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidDomain = errors.New("invalid domain")
ErrInvalidDomain is returned for syntactically invalid hostnames.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the symlink farm and the on-demand-TLS ask endpoint.
func NewManager ¶
NewManager prepares the symlink farm under dataDir/domains.
func (*Manager) Add ¶
Add maps domain→username (DB row + symlink). Returns store.ErrDomainTaken if another member already owns it, or ErrInvalidDomain on a malformed host.
func (*Manager) AskHandler ¶
AskHandler answers Caddy's on-demand-TLS query: 200 when the domain is mapped (so a cert may be issued), 404 otherwise. Caddy passes the requested host as ?domain=. Bind this to loopback only.