Documentation
¶
Overview ¶
POST /repo/{namespace}/{name}/advertise (read: repo read ACL)
POST /repo/{namespace}/{name}/fetch (read: repo read ACL)
POST /repo/{namespace}/{name}/push (write: repo + branch ACL, non-fast-forward)
Authentication uses bearer tokens resolved against the store's users/tokens tables (store.LookupToken). Access is enforced per repository and, for push, per branch (see store.AddBranchACL / CanPushBranch). A write operation is recorded in the append-only audit_log when an AuditSink is configured.
When no users/tokens are registered the instance is treated as open (CLI default) and anonymous read/write is allowed; a configured branch allowlist still applies to push.
Index ¶
Constants ¶
const DefaultMaxBody = 512 << 20
DefaultMaxBody is the default request body limit (512 MiB).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdvertiseReq ¶
type AdvertiseReq struct {
Have []string `json:"have"`
HaveObjects []string `json:"have_objects"`
WantChanges []string `json:"want_changes,omitempty"`
}
AdvertiseReq/Resp mirror the CLI's smart protocol request/response.
type AdvertiseResp ¶
type AuditSink ¶
type AuditSink interface {
Record(store.AuditEvent)
}
AuditSink receives an AuditEvent for access attempts. The default sink writes to the store's append-only audit_log table; tests can supply a mock.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the VCS protocol handler. It resolves bearer tokens against the central store on every request and enforces repository/branch ACLs.
func New ¶
func New(cs *store.CentralStore, sink AuditSink) *Server
New builds a Server over the given central store. If sink is nil a default store-backed sink is used (writing audit_log). The tokens parameter is gone: tokens are resolved via store.LookupToken on each request.
func (*Server) Handler ¶
Handler returns the HTTP router for this server. It may be mounted directly (e.g. http.Server{Handler: s.Handler()} or embedded in a larger mux).
func (*Server) SetMaxBody ¶
SetMaxBody overrides the request body limit (bytes). Values <= 0 restore the default.