nodeinfo

package
v0.0.0-...-9914b64 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package nodeinfo provides /nodeinfo/* endpoints.

Index

Constants

View Source
const CacheTTL = 10 * time.Minute

CacheTTL mirrors upstream NodeinfoServerService の `new MemorySingleCache<...>(1000 * 60 * 10)` (10 分)。

**サーバー側キャッシュが無いと未認証の 1 リクエストごとに全表 COUNT が 2 本走る** (`CountLocalUsers` + `CountLocalNotes`)。`/nodeinfo/*` は `s.echo.GET` 直付けで rate limiter (`/api` グループ専用) も掛からないので、 外部から無制限に回せる。Cache-Control: max-age=600 は返していたが、 それは中継キャッシュ任せで origin には効かない。

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler handles nodeinfo endpoints.

func NewHandler

func NewHandler(cfg *config.Config) *Handler

NewHandler constructs a Handler.

func (*Handler) DropLocal

func (h *Handler) DropLocal()

DropLocal drops the cached documents of this process (#3721). It is what the cache list of internal/server calls (docs/architecture.md 4.4). No other process is told. The caller drops the meta row cache first, as for InvalidateCache.

func (*Handler) InvalidateCache

func (h *Handler) InvalidateCache()

InvalidateCache drops the cached documents, so the next request rebuilds them from the current meta.

internal:metaUpdated で呼ぶ (#3663)。呼ばないと、管理画面でサーバーの名前や 登録の可否を変えても、最大 CacheTTL (10 分) 古い document を配り続ける。 **meta 行のキャッシュを先に捨ててから呼ぶこと** (逆だと、捨てた直後の 組み立てが古い meta 行を読む)。本家はここを捨てず、TTL まで古いまま。

func (*Handler) SetCacheTTL

func (h *Handler) SetCacheTTL(d time.Duration)

SetCacheTTL overrides the server-side cache TTL. Intended for tests; in production the default (CacheTTL) matches the Cache-Control header so clients and the origin see the same freshness window.

0 以下を渡すとキャッシュを無効化する (毎回 build し直す)。

func (*Handler) SetClock

func (h *Handler) SetClock(now func() time.Time)

SetClock overrides the clock source. Intended for tests.

func (*Handler) SetMetaRepo

func (h *Handler) SetMetaRepo(r repository.MetaRepository)

SetMetaRepo injects a MetaRepository so that the nodeName / nodeDescription fields reflect the live admin settings instead of the config default. 未配線のまま呼ばれると cfg.Host fallback になる (#348)。

func (*Handler) SetPeeredPlugins

func (h *Handler) SetPeeredPlugins(names []string)

SetPeeredPlugins declares the plugins that accept the mk-go-only plugin channel (#2537), so other instances can tell whether sending is worthwhile.

**宣言したものだけを渡すこと。** 入れているプラグインを全部並べると、 運営者がどんな拡張を使っているかが攻撃面の情報になる。

func (*Handler) SetProxyAccountResolver

func (h *Handler) SetProxyAccountResolver(r func() (string, bool))

SetProxyAccountResolver wires the resolver used to populate the metadata.proxyAccountName field (#1777)。未配線なら proxyAccountName は null。

func (*Handler) SetUsageRepos

func (h *Handler) SetUsageRepos(userRepo repository.UserRepository, noteRepo repository.NoteRepository)

SetUsageRepos injects repositories used to populate the usage statistics (users.total / activeMonth / activeHalfyear / localPosts / localComments). 未配線のまま呼ばれると対応 field は 0 のままになる (#403)。

func (*Handler) Version2_0

func (h *Handler) Version2_0(c *echo.Context) error

Version2_0 handles GET /nodeinfo/2.0. /.well-known/nodeinfo が 2.0 リンクも advertise するため、upstream NodeinfoServerService と同じく 2.0 も配信する (#1777)。schema 2.0 には software.repository が無いので省略する (upstream は version 2.0 で software.repository を delete する)。

func (*Handler) Version2_1

func (h *Handler) Version2_1(c *echo.Context) error

Version2_1 handles GET /nodeinfo/2.1.

Jump to

Keyboard shortcuts

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