admin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

internal/admin/handler.go

internal/admin/schema.go

Index

Constants

View Source
const SchemaVersion = "1"

SchemaVersion is bumped only on breaking changes to admin/JSON responses.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(c Core) http.Handler

NewHandler returns the admin HTTP handler.

Types

type Core

type Core interface {
	Secret() string
	Share(ShareRequest) (SharePayload, error)
	Revoke(id string) error
	Reshare(id string) (SharePayload, error)
	List() ListResponse
	Status() StatusResponse
	Stop()
}

Core is the subset of the daemon that the admin handler needs.

type IDRequest

type IDRequest struct {
	ID string `json:"id"`
}

type ListEntry

type ListEntry struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	URL       string    `json:"url"`
	ExpiresAt time.Time `json:"expires_at"`
	Remaining int64     `json:"remaining_seconds"`
}

type ListResponse

type ListResponse struct {
	SchemaVersion string      `json:"schema_version"`
	Shares        []ListEntry `json:"shares"`
}

type OKResponse

type OKResponse struct {
	SchemaVersion string `json:"schema_version"`
	OK            bool   `json:"ok"`
}

type SharePayload

type SharePayload struct {
	SchemaVersion string    `json:"schema_version"`
	ID            string    `json:"id"`
	Token         string    `json:"token"`
	URL           string    `json:"url"`
	ExpiresAt     time.Time `json:"expires_at"`
}

type ShareRequest

type ShareRequest struct {
	SrcPath     string `json:"src_path"`
	DisplayName string `json:"display_name,omitempty"`
	TTLSeconds  int64  `json:"ttl_seconds,omitempty"`
}

type StatusResponse

type StatusResponse struct {
	SchemaVersion string `json:"schema_version"`
	PID           int    `json:"pid"`
	Uptime        int64  `json:"uptime_seconds"`
	Port          int    `json:"port"`
	ActiveCount   int    `json:"active_count"`
	Version       string `json:"version"`
}

Jump to

Keyboard shortcuts

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