Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
ggsrcPublic archive

About

gopkg for server

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

⚠️ Frozen (2026-11-03). Use github.com/ggsrc/gglib instead.

gopkg gets no new features and no routine dependency updates. Its remaining users (gopkg/otel and gopkg/env in a few Alva services) move to gglib's single observability entry point; after that the repository will be archived. The modules stay downloadable from the Go module proxy. The previous notice pointed to blueprint-go-toolkits, which is archived.

project-logo

gopkg

Efficiency Unleashed.

Developed with the software and tools below.

YAML GitHub%20Actions Go


Overview

codecov


Repository Structure

└── ./
    ├── .github
    │   ├── dependabot.yml
    │   └── workflows
    ├── Makefile
    ├── README.md
    ├── database
    │   ├── cache
    │   └── wpgx
    ├── env
    │   ├── env.go
    │   ├── go.mod
    │   ├── host.go
    │   └── service.go
    ├── go.work
    ├── go.work.sum
    ├── goodns
    │   ├── go.mod
    │   ├── go.sum
    │   └── goodns.go
    ├── grpc
    │   ├── client.go
    │   ├── go.mod
    │   ├── go.sum
    │   ├── server.go
    │   └── util.go
    ├── health
    │   ├── go.mod
    │   ├── go.sum
    │   └── health.go
    ├── interceptor
    │   ├── go.mod
    │   ├── go.sum
    │   ├── grpc
    │   ├── http
    │   └── metadata
    ├── metric
    │   ├── go.mod
    │   ├── go.sum
    │   └── metric.go
    ├── rpcutil
    │   ├── Init.go
    │   ├── README.md
    │   ├── go.mod
    │   ├── go.sum
    │   └── resource.go
    ├── utils
    │   ├── go.mod
    │   ├── go.sum
    │   └── trace.go
    └── zerolog
        ├── go.mod
        ├── go.sum
        ├── init.go
        ├── log
        └── otel.go

Modules

grpc
File Summary
server.go Establishes a gRPC server, configuring it with interceptors for logging, metrics, and context management, and integrates OpenTelemetry for distributed tracing. Facilitates the registration of services, manages server lifecycle, and ensures graceful shutdown.
client.go Establishes a gRPC client connection, integrating logging, metrics, and error tracking through interceptors, enhancing observability and reliability in client-server communication.
util.go Determines device type from user agent strings, extracts IP addresses from HTTP requests, and manages metadata retrieval for context-aware operations in gRPC services.
health
File Summary
health.go Manages health checks for services, ensuring readiness and liveness by periodically probing dependencies and serving HTTP endpoints to report status, enhancing system reliability and uptime.
goodns
File Summary
goodns.go Implements DNS A record lookups, offering flexibility in querying either default or specified DNS servers over TCP or UDP, enhancing domain resolution capabilities within the repositorys networking utilities.
utils
File Summary
trace.go Initiates and configures tracing for the application, integrating OpenTelemetry to capture service-level and internal span details, enhancing observability and debugging capabilities.
env
File Summary
env.go Determines the environment mode by checking the ENV or OTEL_DEPLOYMENT_ENVIRONMENT environment variables, classifying it as production, beta, staging, local, or unit test.
service.go Initializes and manages the service name by retrieving it from environment variables or setting it manually, ensuring a consistent identifier across the application.
host.go Initializes and retrieves the host name from environment variables, defaulting to UnknownHost if not set, ensuring consistent identification across the system.
zerolog
File Summary
otel.go Initializes a default logging system integrating OpenTelemetry for distributed tracing and zerolog for structured logging, adapting batch size based on environment staging status.
init.go Initializes the logging framework, adjusting log level based on debug mode and integrating OpenTelemetry for enhanced observability.
rpcutil
File Summary
resource.go Manages application resources, orchestrating their startup and graceful shutdown, while monitoring for system signals and errors to ensure stability and reliability.
Init.go Configures and initializes various components of the application, including gRPC server, database, cache, health checks, and metrics, with customizable options for debugging and application naming.
metric
File Summary
metric.go Implements a metrics server that exposes Prometheus metrics via HTTP, configurable through environment variables and listening on a specified port.
database.cache
File Summary
config.go Configures and initializes a Redis client with various modes and failover options, integrating tracing and metrics instrumentation for monitoring and reliability.
dcache.go Establishes a distributed caching system, integrating Redis and in-memory caching for efficient data retrieval and storage, configurable via environment variables to optimize performance and monitoring.
cache.go Implements a caching mechanism using Redis, providing methods to retrieve, set, and invalidate cache entries with optional expiration and locking for concurrent access control.
init.go Initializes the caching system by establishing a Redis connection and initializing a distributed cache instance, ensuring efficient data storage and retrieval for the application.
database.wpgx
File Summary
pool.go Initializes a WPGX database pool, integrating environment configuration and logging for robust database connectivity within the applications architecture.
init.go Initializes the database connection pool, ensuring a timed context for establishing a PostgreSQL connection, critical for managing database interactions within the application.
zerolog.log
File Summary
ctx.go Enhances logging capabilities by integrating context-aware logging, configurable output, and customizable logging levels, ensuring detailed and flexible logging across the application.
interceptor.grpc
File Summary
recovery.go Implements error recovery for gRPC services, capturing panics and logging detailed stack traces, enhancing system stability and aiding in debugging.
context.go Enhances gRPC communication by intercepting and enriching context with metadata, including request source, JWT tokens, access tokens, Galxe ID, and origin, ensuring secure and informed processing of requests and responses.
interceptor.http
File Summary
proxy.go Enhances HTTP request handling by adjusting the RemoteAddr field based on the X-Forwarded-For header, ensuring accurate client IP tracking in reverse proxy scenarios.
interceptor.metadata
File Summary
metadata.go Defines context keys and request sources for metadata storage, facilitating identification and categorization of incoming requests within the applications interceptor framework.

About

gopkg for server

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages