Documentation
¶
Overview ¶
internal/admin/handler.go
internal/admin/info.go
internal/admin/schema.go
Index ¶
Constants ¶
const SchemaVersion = "1"
SchemaVersion is bumped only on breaking changes to admin/JSON responses.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound indicates that a query parsed successfully but no matching share exists (or the share is revoked/expired). Handlers map this to 404. Parse failures, by contrast, should surface as 400.
Functions ¶
func ParseInfoQuery ¶ added in v0.2.0
ParseInfoQuery normalizes one of {full URL, path /t/<tok>/<name>, bare token, bare id} into either a token (26-char base32) or an id (8-char base32). Exactly one of the returned values is populated on success.
Types ¶
type Core ¶
type Core interface {
Secret() string
Revoke(id string) error
Info(query string) (InfoPayload, error)
List() ListResponse
Status() StatusResponse
Stop()
}
Core is the subset of the daemon that the admin handler needs.
type InfoPayload ¶ added in v0.2.0
type InfoPayload struct {
SrcPath string `json:"src_path"`
CreatedAt time.Time `json:"created_at"`
}
InfoPayload augments SharePayload with src_path and created_at, returned by GET /info. Token is intentionally included (via embedded SharePayload) because /info is on the Bearer-auth-gated admin API, same as /share and /list; callers already have the secret and can obtain the token via /list anyway.
type ListResponse ¶
type ListResponse struct {
SchemaVersion string `json:"schema_version"`
}
type OKResponse ¶
type SharePayload ¶
type SharePayload struct {
}
type ShareRequest ¶
type ShareRequest struct {
}