admin

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package admin serves the voting-config endpoint by proxying the GitHub Pages CDN (valargroup/token-holder-voting-config).

Server registration, approval, and removal happen via GitHub PRs on the config repo — no write endpoints here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(
	router *mux.Router,
	getAdmin func() *Admin,
	logger log.Logger,
)

RegisterRoutes registers admin HTTP routes on the given mux router.

Types

type Admin

type Admin struct {
	// contains filtered or unexported fields
}

Admin fetches and caches the voting-config from the GitHub Pages CDN.

func New

func New(cfg Config, logger log.Logger) (*Admin, error)

New creates a new Admin from the given configuration.

func (*Admin) GetVotingConfig added in v0.5.0

func (a *Admin) GetVotingConfig() (*VotingConfig, error)

GetVotingConfig returns the cached voting config, refreshing if stale.

type Config

type Config struct {
	// Disable turns off the admin server entirely.
	Disable bool `mapstructure:"disable"`

	// ConfigURL is the GitHub Pages CDN URL for the voting-config JSON.
	ConfigURL string `mapstructure:"config_url"`
}

Config holds the admin server configuration, read from app.toml admin.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default admin configuration.

type ServiceEntry

type ServiceEntry struct {
	URL             string `json:"url"`
	Label           string `json:"label"`
	OperatorAddress string `json:"operator_address,omitempty"`
}

ServiceEntry is the wire format for a server in the voting-config response.

type VotingConfig

type VotingConfig struct {
	Version     int            `json:"version"`
	VoteServers []ServiceEntry `json:"vote_servers"`
	PIRServers  []ServiceEntry `json:"pir_endpoints"`
}

VotingConfig is the wire format returned by GET /api/voting-config.

Jump to

Keyboard shortcuts

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