Help us shape the future of Go! Take the 2026 Go Developer Survey

tool

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tool implements the admin tool subdomain of the platform module: the system log tail, the version, IP geolocation and the process restart. Only the module facade may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	// LogPath is the logger output file read by the system-log tail.
	LogPath string
	// GeoIP returns the GeoIP database reader; nil (or a nil result) means
	// no database is configured.
	GeoIP func() *geoip2.Reader
	// Restart restarts the transport server.
	Restart func() error
}

Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.

type Service

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

Service is the tool entry point used by the platform facade.

func NewService

func NewService(deps Deps) *Service

NewService builds the admin tool service.

func (*Service) GetSystemLog

func (s *Service) GetSystemLog(ctx context.Context) (*dto.LogResponse, error)

GetSystemLog returns the latest system log entries, newest first. A line that is not a JSON entry is skipped, but a tail in which no line is one is an error: the log is not written in the format the tail shows.

func (*Service) GetVersion

func (s *Service) GetVersion(_ context.Context) (*dto.VersionResponse, error)

GetVersion reports the version the server was built as.

func (*Service) QueryIPLocation

QueryIPLocation looks an IP address up in the local GeoIP database.

func (*Service) RestartSystem

func (s *Service) RestartSystem(ctx context.Context) error

RestartSystem restarts the transport server in the background and returns at once: the restart replaces the server answering this request. Its outcome is only logged.

Jump to

Keyboard shortcuts

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