server

package
v0.9.7-dev.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: GPL-3.0 Imports: 32 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnboardingAPI added in v0.9.4

type OnboardingAPI interface {
	OnboardingStatus(context.Context) (onboarding.Snapshot, error)
	UpdateOnboarding(context.Context, runtimeapi.Operation, onboarding.Update) (onboarding.Snapshot, error)
}

OnboardingAPI is the narrow daemon-owned setup surface, also available during port recovery.

type Options

type Options struct {
	Onboarding         OnboardingAPI
	Token              string
	Store              *state.Store
	Runtime            RuntimeAPI
	Now                func() time.Time
	SnapshotSource     logging.MachineSnapshotSource
	SnapshotID         func() string
	DiagnosticReporter diagnostics.Reporter
	DiagnosticHistory  *diagnostics.History
}

type RuntimeAPI

type RuntimeAPI interface {
	Capabilities() []string
	Snapshot() state.Snapshot
	Install(context.Context, runtimeapi.Operation) (core.InstallResult, error)
	Restart(context.Context, runtimeapi.Operation) error
	Proxies(context.Context) (mihomo.Proxies, error)
	ProxyCatalog(context.Context) (mihomo.Proxies, []string, error)
	SelectProxy(context.Context, runtimeapi.Operation, string, string) error
	DelayGroup(context.Context, string, string, int) (mihomo.Delays, error)
	DelayProxy(context.Context, string, string, int) (uint16, error)
	Connections(context.Context) (mihomo.Connections, error)
	CloseConnection(context.Context, runtimeapi.Operation, string) error
	CloseAllConnections(context.Context, runtimeapi.Operation) error
	Rules(context.Context) (mihomo.Rules, error)
	RuleProviders(context.Context) (mihomo.RuleProviders, error)
	UpdateRuleProvider(context.Context, runtimeapi.Operation, string) error
	Stream(context.Context, mihomo.StreamKind, func(json.RawMessage) error) error
	GeoIPStatus(context.Context) (geoip.Status, error)
	LookupGeoIP(context.Context, []netip.Addr) ([]geoip.Record, error)
	UpdateGeoIP(context.Context, runtimeapi.Operation) (geoip.Status, error)
	SystemProxyStatus(context.Context) (protocol.SystemProxyStatus, error)
	EnableSystemProxy(context.Context, runtimeapi.Operation, bool) (protocol.SystemProxyStatus, error)
	DisableSystemProxy(context.Context, runtimeapi.Operation) (protocol.SystemProxyStatus, error)
	TunStatus(context.Context) (protocol.TunStatus, error)
	EnableTun(context.Context, runtimeapi.Operation, bool) (protocol.TunStatus, error)
	DisableTun(context.Context, runtimeapi.Operation) (protocol.TunStatus, error)
}

type Server

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

func New

func New(options Options) *Server

New assembles local control handlers and selects the injected or runtime onboarding surface.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler authenticates local control requests and ties their lifetime to server shutdown.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, listener net.Listener) error

Jump to

Keyboard shortcuts

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