Илья Глазунов bd0b381195 feat(caching): Implement cache hit detection and response header management
- Added functionality to mark responses as cache hits to prevent incorrect X-Cache headers.
- Introduced setCacheHitFlag function to traverse response writer wrappers and set cache hit flag.
- Updated cachingResponseWriter to manage cache hit state and adjust X-Cache header accordingly.
- Enhanced ProcessRequest and ProcessResponse methods to utilize new caching logic.

feat(extension): Introduce ResponseWriterWrapper and ResponseFinalizer interfaces

- Added ResponseWriterWrapper interface for extensions to wrap response writers.
- Introduced ResponseFinalizer interface for finalizing responses after processing.

refactor(manager): Improve response writer wrapping and finalization

- Updated Manager.Handler to wrap response writers through all enabled extensions.
- Implemented finalization of response writers after processing requests.

test(caching): Add comprehensive integration tests for caching behavior

- Created caching_test.go with tests for cache hit/miss, TTL expiration, pattern-based caching, and more.
- Ensured that caching logic works correctly for various scenarios including query strings and error responses.

test(routing): Add integration tests for routing behavior

- Created routing_test.go with tests for route priority, case sensitivity, default routes, and return directives.
- Verified that routing behaves as expected with multiple regex routes and named groups.
2025-12-12 01:03:32 +03:00
..
2025-12-11 16:52:13 +03:00
2025-12-11 16:52:13 +03:00
2025-12-11 16:52:13 +03:00
2025-12-11 16:52:13 +03:00

Konduktor (Go)

High-performance HTTP web server with extensible routing and process orchestration. (Previously known as PyServe in Python)

Project Structure

go/
├── cmd/
│   ├── konduktor/        # Main server binary
│   └── konduktorctl/     # CLI management tool
├── internal/
│   ├── config/           # Configuration management
│   ├── logging/          # Structured logging
│   ├── middleware/       # HTTP middleware
│   ├── routing/          # HTTP routing
│   ├── extensions/       # Extension system (TODO)
│   └── process/          # Process management (TODO)
├── pkg/                  # Public packages (TODO)
├── go.mod
├── go.sum
└── Makefile

Building

cd go

# Download dependencies
make deps

# Build all binaries
make build

# Or build individually
make build-konduktor
make build-konduktorctl

Running

# Run with default config
./bin/konduktor

# Run with custom config
./bin/konduktor -c ../config.yaml

# Run with flags
./bin/konduktor --host 127.0.0.1 --port 3000 --debug

CLI Commands (konduktorctl)

# Start services
konduktorctl up

# Stop services
konduktorctl down

# View status
konduktorctl status

# View logs
konduktorctl logs -f

# Health check
konduktorctl health

# Scale services
konduktorctl scale api=3

# Configuration management
konduktorctl config show
konduktorctl config validate

# Initialize new project
konduktorctl init

Configuration

Uses the same YAML configuration format as the Python version:

server:
  host: 0.0.0.0
  port: 8080
  
http:
  static_dir: ./static
  templates_dir: ./templates

ssl:
  enabled: false
  cert_file: ./ssl/cert.pem
  key_file: ./ssl/key.pem

logging:
  level: INFO
  console_output: true

extensions:
  - type: routing
    config:
      regex_locations:
        "=/health":
          return: "200 OK"

Development

# Format code
make fmt

# Run linter
make lint

# Run tests
make test

# Run with coverage
make test-coverage

Migration from Python

This is a gradual rewrite of PyServe to Go. The project is now called Konduktor.

Completed

  • Basic project structure
  • Configuration loading
  • HTTP server with graceful shutdown
  • Basic routing
  • Middleware (access log, recovery, server header)
  • CLI structure (konduktor, konduktorctl)

TODO

  • Extension system
  • Regex routing
  • Reverse proxy
  • Process orchestration
  • ASGI/WSGI adapter support
  • WebSocket support
  • Hot reload
  • Metrics and monitoring