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

serverv1

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package serverv1 implements NeXT-Panel Server API V1 (/api/server/v1).

Index

Constants

This section is empty.

Variables

View Source
var ErrNodeUnavailable = errors.New("node unavailable")

ErrNodeUnavailable is wrapped by FetchUsers when the panel refuses to serve users to this node at all, and the node must stop accepting them.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(options option.ServerOptions) (*Client, error)

func (*Client) FetchDetectRules

func (c *Client) FetchDetectRules(ctx context.Context) ([]adapter.DetectRule, error)

func (*Client) FetchNodeConfig

func (c *Client) FetchNodeConfig(ctx context.Context) (*adapter.NodeConfig, error)

func (*Client) FetchUsers

func (c *Client) FetchUsers(ctx context.Context) ([]adapter.User, error)

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, onlineUsers int) error

func (*Client) ReportDetectLogs

func (c *Client) ReportDetectLogs(ctx context.Context, items []adapter.DetectLog) error

func (*Client) ReportOnline

func (c *Client) ReportOnline(ctx context.Context, items []adapter.UserOnline) error

func (*Client) ReportTraffic

func (c *Client) ReportTraffic(ctx context.Context, items []adapter.UserTraffic) error

type Error

type Error struct {
	Status  int
	Code    string
	Message string
}

Error is an API error response: {"error": {"code", "message"}}.

func (*Error) Error

func (e *Error) Error() string

type Number

type Number float64

Number decodes a JSON number or a numeric string. An empty string or null decodes as 0, since that is how the panel's custom_config template leaves unset fields.

func (*Number) UnmarshalJSON

func (n *Number) UnmarshalJSON(content []byte) error

Jump to

Keyboard shortcuts

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