api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

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

Router handles HTTP routing

func NewRouter

func NewRouter(
	authVerifier *auth.Verifier,
	signService *service.SignService,
	signerManager evm.SignerManager,
	ruleRepo storage.RuleRepository,
	auditRepo storage.AuditRepository,
	logger *slog.Logger,
	config RouterConfig,
) (*Router, error)

NewRouter creates a new router

func (*Router) Handler

func (r *Router) Handler() http.Handler

Handler returns the HTTP handler

func (*Router) StartRateLimitCleanup

func (r *Router) StartRateLimitCleanup(stop <-chan struct{})

StartRateLimitCleanup starts the rate limit cleanup routine

type RouterConfig

type RouterConfig struct {
	Version           string
	IPWhitelistConfig *middleware.IPWhitelist
	SolidityValidator *evm.SolidityRuleValidator
	Template          *TemplateConfig
	ApprovalGuard     *service.ManualApprovalGuard // optional: for admin resume endpoint
}

RouterConfig contains configuration for the router

type Server

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

Server represents the HTTP server

func NewServer

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

NewServer creates a new HTTP server

func (*Server) Address

func (s *Server) Address() string

Address returns the server address

func (*Server) Shutdown

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

Shutdown gracefully shuts down the server

func (*Server) Start

func (s *Server) Start() error

Start starts the HTTP server

type ServerConfig

type ServerConfig struct {
	Host         string        `yaml:"host"`
	Port         int           `yaml:"port"`
	ReadTimeout  time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout"`

	// TLS
	TLSEnabled    bool
	TLSCertFile   string
	TLSKeyFile    string
	TLSCAFile     string // CA cert for mTLS client verification
	TLSClientAuth bool   // Require client certificates (mTLS)
}

ServerConfig contains configuration for the HTTP server

func DefaultServerConfig

func DefaultServerConfig() ServerConfig

DefaultServerConfig returns the default server configuration

type TemplateConfig

type TemplateConfig struct {
	TemplateRepo    storage.TemplateRepository
	TemplateService *service.TemplateService
}

TemplateConfig contains template-related dependencies for the router

Directories

Path Synopsis
evm

Jump to

Keyboard shortcuts

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