api

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled controls whether the API server is enabled.
	Enabled bool `json:"enabled"`

	// DebugPprof enables pprof endpoints for debugging and profiling.
	DebugPprof bool `json:"debugPprof"`

	// EnableTrustedProxyCheck enables trusted proxy checks.
	EnableTrustedProxyCheck bool `json:"enableTrustedProxyCheck"`

	// TrustedProxies is the list of trusted proxies.
	// This only takes effect if EnableTrustedProxyCheck is true.
	TrustedProxies []string `json:"trustedProxies"`

	// ProxyHeader is the header used to determine the client's IP address.
	// If empty, the remote peer's address is used.
	ProxyHeader string `json:"proxyHeader"`

	// ListenAddress is the address to listen on.
	ListenAddress string `json:"listen"`

	// CertFile is the path to the certificate file.
	// If empty, TLS is disabled.
	CertFile string `json:"certFile"`

	// KeyFile is the path to the key file.
	// This is required if CertFile is set.
	KeyFile string `json:"keyFile"`

	// ClientCertFile is the path to the client certificate file.
	// If empty, client certificate authentication is disabled.
	ClientCertFile string `json:"clientCertFile"`

	// StaticPath is the path where static files are served from.
	// If empty, static file serving is disabled.
	StaticPath string `json:"staticPath"`

	// SecretPath adds a secret path prefix to all routes.
	// If empty, no secret path is added.
	SecretPath string `json:"secretPath"`

	// FiberConfigPath overrides the [fiber.Config] settings we use.
	// If empty, no overrides are applied.
	FiberConfigPath string `json:"fiberConfigPath"`
}

Config stores the configuration for the RESTful API.

func (*Config) Server

func (c *Config) Server(logger *zap.Logger) (*Server, *ssm.ServerManager, error)

Server returns a new API server from the config.

type Server

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

Server is the RESTful API server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the API server.

func (*Server) Stop

func (s *Server) Stop() error

Stop stops the API server.

func (*Server) String

func (s *Server) String() string

String implements [service.Service.String].

Directories

Path Synopsis
Package ssm implements the Shadowsocks Server Management API v1.
Package ssm implements the Shadowsocks Server Management API v1.

Jump to

Keyboard shortcuts

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