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

serverapi

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Service assembly for the node-facing server API subdomain of the network module: config pulls, user lists, status/traffic pushes. Only the module facade may reach it.

Index

Constants

View Source
const (
	Unchanged    = "Unchanged"
	ShadowSocks  = "shadowsocks"
	Vmess        = "vmess"
	Vless        = "vless"
	Trojan       = "trojan"
	AnyTLS       = "anytls"
	Tuic         = "tuic"
	ShadowsocksR = "shadowsocksr"
	Mieru        = "mieru"
	Naive        = "naive"
	Snell        = "snell"
	Hysteria     = "hysteria"
	// Deprecated: Hysteria2 is deprecated, use Hysteria instead
	// TODO: remove in future versions
	Hysteria2 = "hysteria2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyTLSNode

type AnyTLSNode struct {
	Port           uint16          `json:"port"`
	SecurityConfig *SecurityConfig `json:"security_config"`
}

type Deps

type Deps struct {
	Store repository.Store
	Redis *redis.Client
	// Config snapshots the runtime-mutable settings per request.
	Config func() Snapshot
	// Multiplier returns the node traffic multiplier in effect at the given
	// time; nil means no multiplier is configured.
	Multiplier func(at time.Time) float32
}

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

type GetServerConfigLogic

type GetServerConfigLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*GetServerConfigLogic) GetServerConfig

func (l *GetServerConfigLogic) GetServerConfig(req *dto.GetServerConfigRequest) (resp *dto.GetServerConfigResponse, err error)

func (*GetServerConfigLogic) ResponseMeta

func (l *GetServerConfigLogic) ResponseMeta() ResponseMeta

type GetServerUserListLogic

type GetServerUserListLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*GetServerUserListLogic) GetServerUserList

func (*GetServerUserListLogic) ResponseMeta

func (l *GetServerUserListLogic) ResponseMeta() ResponseMeta

type Hysteria2Node

type Hysteria2Node struct {
	Port           uint16          `json:"port"`
	HopPorts       string          `json:"hop_ports"`
	HopInterval    int             `json:"hop_interval"`
	ObfsPassword   string          `json:"obfs_password"`
	SecurityConfig *SecurityConfig `json:"security_config"`
}

type PushOnlineUsersLogic

type PushOnlineUsersLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*PushOnlineUsersLogic) PushOnlineUsers

func (l *PushOnlineUsersLogic) PushOnlineUsers(req *dto.OnlineUsersRequest) error

type QueryServerProtocolConfigLogic

type QueryServerProtocolConfigLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*QueryServerProtocolConfigLogic) QueryServerProtocolConfig

func (l *QueryServerProtocolConfigLogic) QueryServerProtocolConfig(req *dto.QueryServerConfigRequest) (resp *dto.QueryServerConfigResponse, err error)

type RequestMeta

type RequestMeta struct {
	IfNoneMatch string
}

type ResponseMeta

type ResponseMeta struct {
	Headers map[string]string
}

func NewResponseMeta

func NewResponseMeta() ResponseMeta

func (*ResponseMeta) SetHeader

func (m *ResponseMeta) SetHeader(key, value string)

type SecurityConfig

type SecurityConfig struct {
	SNI                  string `json:"sni"`
	AllowInsecure        *bool  `json:"allow_insecure"`
	Fingerprint          string `json:"fingerprint"`
	RealityServerAddress string `json:"reality_server_addr"`
	RealityServerPort    int    `json:"reality_server_port"`
	RealityPrivateKey    string `json:"reality_private_key"`
	RealityPublicKey     string `json:"reality_public_key"`
	RealityShortId       string `json:"reality_short_id"`
	RealityMldsa65seed   string `json:"reality_mldsa65seed"`
	PaddingScheme        string `json:"padding_scheme"`
}

type ServerPushStatusLogic

type ServerPushStatusLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*ServerPushStatusLogic) ServerPushStatus

func (l *ServerPushStatusLogic) ServerPushStatus(req *dto.ServerPushStatusRequest) error

type ServerPushUserTrafficLogic

type ServerPushUserTrafficLogic struct {
	logger.Logger
	// contains filtered or unexported fields
}

func (*ServerPushUserTrafficLogic) ServerPushUserTraffic

func (l *ServerPushUserTrafficLogic) ServerPushUserTraffic(req *dto.ServerPushUserTrafficRequest) error

type Service

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

Service is the node-facing API entry point used by the network facade.

func NewService

func NewService(deps Deps) *Service

func (*Service) PushOnlineUsers

func (s *Service) PushOnlineUsers(ctx context.Context, req *dto.OnlineUsersRequest) error

func (*Service) QueryServerProtocolConfig

func (s *Service) QueryServerProtocolConfig(ctx context.Context, req *dto.QueryServerConfigRequest) (*dto.QueryServerConfigResponse, error)

func (*Service) ServerPushStatus

func (s *Service) ServerPushStatus(ctx context.Context, req *dto.ServerPushStatusRequest) error

func (*Service) ServerPushUserTraffic

func (s *Service) ServerPushUserTraffic(ctx context.Context, req *dto.ServerPushUserTrafficRequest) error

type ShadowsocksNode

type ShadowsocksNode struct {
	Port      uint16 `json:"port"`
	Cipher    string `json:"method"`
	ServerKey string `json:"server_key"`
}

type Snapshot

type Snapshot struct {
	Node      config.NodeConfig
	Subscribe config.SubscribeConfig
}

Snapshot is the per-request view of the runtime-mutable settings the node API consumes.

type TransportConfig

type TransportConfig struct {
	Path                 string `json:"path"`
	Host                 string `json:"host"`
	ServiceName          string `json:"service_name"`
	DisableSNI           bool   `json:"disable_sni"`
	ReduceRtt            bool   `json:"reduce_rtt"`
	UDPRelayMode         string `json:"udp_relay_mode"`
	CongestionController string `json:"congestion_controller"`
}

type TrojanNode

type TrojanNode struct {
	Port            uint16           `json:"port"`
	Network         string           `json:"transport"`
	TransportConfig *TransportConfig `json:"transport_config"`
	Security        string           `json:"security"`
	SecurityConfig  *SecurityConfig  `json:"security_config"`
}

type TuicNode

type TuicNode struct {
	Port           uint16          `json:"port"`
	SecurityConfig *SecurityConfig `json:"security_config"`
}

type VlessNode

type VlessNode struct {
	Port            uint16           `json:"port"`
	Flow            string           `json:"flow"`
	Network         string           `json:"transport"`
	TransportConfig *TransportConfig `json:"transport_config"`
	Security        string           `json:"security"`
	SecurityConfig  *SecurityConfig  `json:"security_config"`
}

type VmessNode

type VmessNode struct {
	Port            uint16           `json:"port"`
	Network         string           `json:"transport"`
	TransportConfig *TransportConfig `json:"transport_config"`
	Security        string           `json:"security"`
	SecurityConfig  *SecurityConfig  `json:"security_config"`
}

Jump to

Keyboard shortcuts

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