Documentation
¶
Overview ¶
Package web holds the HTTP server, the routes, the middleware, the handlers and the server-sent event streams. It never imports internal/store.
Index ¶
Constants ¶
const CallSocketPath = "/calls/{id}/ws"
CallSocketPath is the pattern of the path of the signalling socket of the call in a direct conversation, GET /calls/{id}/ws with the ID of the conversation (SPEC §7.18).
Variables ¶
This section is empty.
Functions ¶
func ClientIPFunc ¶ added in v1.1.0
ClientIPFunc returns the function that finds the address of the client of a request, for the login limiter: the connection's address, or with trustProxy the last address of X-Forwarded-For (see clientIP). It is what the API is given as api.Options.ClientIP.
Types ¶
type HealthChecker ¶ added in v1.1.0
type HealthChecker interface {
// Check returns nil when the database answers within ctx.
Check(ctx context.Context) error
}
HealthChecker tells whether the server can do its work. app.Health is the one the binary uses.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server of Clowder: the routes, the middleware and the handlers. Make it with New.
func New ¶
New makes the server from its dependencies. Run starts it. It fails when the embedded static files cannot be read and hashed.
type Services ¶
type Services struct {
// Accounts is the service of login, sessions, invitations and users.
Accounts *app.Accounts
// Rooms is the service of rooms and their memberships.
Rooms *app.Rooms
// Audit is the service that reads the audit log.
Audit *app.Audit
// Posts is the service of posts, their tags and their feeds.
Posts *app.Posts
// Board is the service of the Kanban boards. The streams read it to find
// the posts whose tasks a change of the columns concerns.
Board *app.Board
// Search is the service of search.
Search *app.Search
// Notifications is the service of the notifications of a user: their
// unread count in the sidebar and their page.
Notifications *app.Notifications
// Messages is the service of private conversations and messages: their
// pages, their streams and the unread count in the sidebar.
Messages *app.Messages
// Prefs is the service of the notification preferences of a user in a
// room or a conversation, and of the notices their streams carry.
Prefs *app.Prefs
// Presence tells who is online and is told when a stream opens or closes
// (SPEC §7.15). Nil counts nobody.
Presence *app.Presence
// SSHKeys is the service of the SSH keys of a user and of what the
// settings page shows of the SSH server (SPEC §7.16).
SSHKeys *app.SSHKeys
// Calls is the service of the one-to-one calls (SPEC §7.18). Nil serves no
// call socket.
Calls *app.Calls
// Media is the media server of the calls, which runs the signalling
// socket. Nil when calls are off.
Media *calls.Server
// Health answers the health check, GET /healthz (SPEC D40). Nil makes
// the check answer 503.
Health HealthChecker
// API is the REST API (SPEC D42). Its routes are mounted on the same mux
// under /api/v1/ and never read the session cookie. Nil serves no API:
// every /api/ path is then the page-not-found error page.
API *api.Server
// Hub delivers the live events of the services to the streams of the
// pages (SPEC §8). The services must publish to the same hub. Nil makes a
// hub that nothing publishes to.
Hub *live.Hub
// Connections counts the live connections of each user in this process,
// for the limit of SPEC D62; it must be the one of the API. Nil limits
// nothing.
Connections *app.Connections
// Metrics receives the requests that ended and the open streams (SPEC
// D60). Nil reports nothing.
Metrics *metrics.Set
}
Services are the services the handlers call. Later steps add a field for each service they build.
Source Files
¶
- admin.go
- admin_audit.go
- admin_rooms.go
- board.go
- board_stream.go
- calls.go
- calls_pages.go
- connections.go
- doc.go
- errors.go
- files.go
- follow.go
- health.go
- login.go
- logincode.go
- me_stream.go
- mentions.go
- messages.go
- messages_stream.go
- middleware.go
- notifications.go
- notify.go
- posts.go
- reset.go
- rooms.go
- search.go
- security.go
- server.go
- session.go
- sessions.go
- settings.go
- signin.go
- signup.go
- static.go
- stream.go
- tasks.go
- uploads.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package static holds the files the server sends as they are: the Datastar client, the stylesheet and the scripts.
|
Package static holds the files the server sends as they are: the Datastar client, the stylesheet and the scripts. |
|
Package views holds the templ components and pages.
|
Package views holds the templ components and pages. |