socket

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 15 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

func ValidateUnixSocketPerms

func ValidateUnixSocketPerms(path string) error

Types

type ConfigGetter

type ConfigGetter interface {
	Get(ctx context.Context, key string) (interface{}, error)
}

type ConfigSetter

type ConfigSetter interface {
	Set(ctx context.Context, key string, value interface{}) error
}

type Handler

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

func NewHandler

func NewHandler(
	tokenResolver TokenResolver,
	proxyStatus ProxyStatusProvider,
	configGetter ConfigGetter,
	configSetter ConfigSetter,
	shutdownFn func(),
) *Handler

func (*Handler) RegisterMethods

func (h *Handler) RegisterMethods(server *Server)

type MethodHandler

type MethodHandler func(ctx context.Context, params json.RawMessage) (interface{}, error)

type ProxyStatusProvider

type ProxyStatusProvider interface {
	Status(ctx context.Context) (interface{}, error)
}

type Server

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

func NewServer

func NewServer(config ServerConfig, logger *slog.Logger) (*Server, error)

func (*Server) ActiveConnections

func (s *Server) ActiveConnections() int64

func (*Server) Addr

func (s *Server) Addr() net.Addr

func (*Server) Authenticate added in v0.6.0

func (s *Server) Authenticate(token string) bool

func (*Server) RegisterMethod

func (s *Server) RegisterMethod(name string, handler MethodHandler)

func (*Server) Serve

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

func (*Server) Shutdown

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

type ServerConfig

type ServerConfig struct {
	Path       string
	Perm       uint32
	MaxMsgSize int64
	RateLimit  int
	AuthToken  string
}

func DefaultConfig

func DefaultConfig() ServerConfig

type SocketServer

type SocketServer interface {
	Serve(ctx context.Context) error
	Shutdown(ctx context.Context) error
	Addr() net.Addr
	Authenticate(token string) bool
}

type TokenResolver

type TokenResolver interface {
	Resolve(ctx context.Context, uri string) (interface{}, error)
}

type UnixTransport

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

func NewUnixTransport

func NewUnixTransport(path string, perm uint32) *UnixTransport

func (*UnixTransport) Listen

func (t *UnixTransport) Listen() (net.Listener, error)

func (*UnixTransport) Path

func (t *UnixTransport) Path() string

Jump to

Keyboard shortcuts

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