Help us shape the future of Go! Take the 2026 Go Developer Survey

server

command module
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

README ΒΆ

PPanel Server

License Go Version Go Report Card Docker CI/CD

PPanel is a pure, professional, and perfect open-source proxy panel tool, designed for learning and practical use.

English | δΈ­ζ–‡ | Report Bug | Request Feature

Article 1.
All human beings are born free and equal in dignity and rights.
They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.

Article 12.
No one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, nor to attacks upon his honour and reputation.
Everyone has the right to the protection of the law against such interference or attacks.

Article 19.
Everyone has the right to freedom of opinion and expression; this right includes freedom to hold opinions without interference and to seek, receive and impart information and ideas through any media and regardless of frontiers.

Source: United Nations – Universal Declaration of Human Rights (UN.org)

πŸ“‹ Overview

PPanel Server is the backend component of the PPanel project, providing robust APIs and core functionality for managing proxy services. Built with Go, it emphasizes performance, security, and scalability.

Key Features
  • Multi-Protocol Support: Supports Shadowsocks, V2Ray, Trojan, and more.
  • Privacy First: No user logs are collected, ensuring privacy and security.
  • Minimalist Design: Simple yet powerful, with complete business logic.
  • User Management: Full authentication and authorization system.
  • Subscription System: Manage user subscriptions and service provisioning.
  • Payment Integration: Supports multiple payment gateways.
  • Order Management: Track and process user orders.
  • Ticket System: Built-in customer support and issue tracking.
  • Node Management: Monitor and control server nodes.
  • API Framework: Comprehensive RESTful APIs for frontend integration.

πŸš€ Quick Start

Prerequisites
  • Go: 1.27.1 or higher
  • Database: MySQL 8.0+, MariaDB 11.8+ or PostgreSQL 16+, and Redis 6.0+
  • Docker: Optional, for containerized deployment
  • Git: For cloning the repository

Deploying a release binary instead of building? See the installation guide (script/install.sh, systemd unit, checksum verification) and the configuration guide.

Installation from Source
  1. Clone the repository:

    git clone https://github.com/perfect-panel/backend.git
    cd backend
    
  2. Install dependencies:

    go mod download
    
  3. Build the project (the binaries land in bin/; pick the target of the machine that will run it):

    make linux-amd64
    
  4. Run the server:

    ./bin/ppanel-server-linux-amd64 run --config etc/ppanel.yaml
    

    With an empty configuration file the first start serves the setup wizard on 127.0.0.1 at the configured Port (http://127.0.0.1:8080/init by default), reachable from the same machine only. On a remote host open an SSH tunnel (ssh -L 8080:127.0.0.1:8080 user@host) or set PPANEL_DB and PPANEL_REDIS for a non-interactive installation; both are described in the installation guide.

🐳 Docker Deployment

The image runs as an unprivileged user (uid 65532), listens on port 8080, reads /app/etc/ppanel.yaml and reports its health through ppanel healthcheck (HEALTHCHECK). The first-run setup wizard listens on 127.0.0.1 inside the container and cannot be reached through a published port, so a container deployment provides the connections in one of two ways:

  • set PPANEL_DB and PPANEL_REDIS: on the first start the server completes the empty configuration file with them and a generated JWT secret, applies the migrations and creates the first administrator, whose password is printed once in docker logs; or
  • mount a pre-filled etc/ppanel.yaml (configuration guide).
Variable Format Example
PPANEL_DB MySQL DSN user:password@tcp(host:port)/dbname, or a URL: mysql://…, postgres://user:password@host:5432/dbname?sslmode=require ppanel:secret@tcp(db.internal:3306)/ppanel
PPANEL_REDIS redis://[:password@]host[:port][/db] redis://:secret@redis.internal:6379/0
  1. Build the Docker image:

    docker buildx build --platform linux/amd64 -t ppanel-server:latest .
    
  2. Run the container. The mounted configuration file must exist and be writable by uid 65532 on the first start, when the server completes it (replace the database and Redis addresses with yours):

    mkdir -p etc && touch etc/ppanel.yaml && sudo chown 65532:65532 etc/ppanel.yaml
    docker run -d --name ppanel-server -p 8080:8080 \
      -e PPANEL_DB='ppanel:secret@tcp(db.internal:3306)/ppanel' \
      -e PPANEL_REDIS='redis://:secret@redis.internal:6379/0' \
      -v "$(pwd)/etc/ppanel.yaml:/app/etc/ppanel.yaml" \
      ppanel-server:latest
    docker logs -f ppanel-server   # prints the first administrator's password once
    
  3. Use Docker Compose. The repository's docker-compose.yml builds the image, publishes port 8080, mounts ./etc/ppanel.yaml and checks the container's health:

    services:
      ppanel:
        container_name: ppanel-server
        build:
          context: .
          dockerfile: Dockerfile
        ports:
          - "8080:8080"
        volumes:
          - ./etc/ppanel.yaml:/app/etc/ppanel.yaml
        # environment:
        #   PPANEL_DB: "ppanel:password@tcp(db:3306)/ppanel"
        #   PPANEL_REDIS: "redis://:password@redis:6379/0"
        healthcheck:
          test: ["CMD", "/app/ppanel", "healthcheck"]
          interval: 30s
          timeout: 5s
          retries: 3
          start_period: 30s
        stop_grace_period: 20s
        restart: always
    

    ./etc/ppanel.yaml must exist as a file before the first docker compose up (Docker creates a directory of that name otherwise) and be writable by uid 65532; uncomment environment or pre-fill the file, then:

    mkdir -p etc && touch etc/ppanel.yaml && sudo chown 65532:65532 etc/ppanel.yaml
    docker compose up -d
    

    stop_grace_period gives the graceful shutdown (HTTP first, then the scheduler, the task worker and the trace exporter, up to about 18 s) the time it needs; with plain docker run, stop with docker stop --time 20.

  4. Pull a published image: ppanel/ppanel-server:lts follows the LTS line (master), :latest the feature line, :beta the prereleases, and ghcr.io/perfect-panel/ppanel-server:nightly is the nightly build of dev:

    docker pull ppanel/ppanel-server:lts
    

The server answers GET /healthz (liveness) and GET /readyz (readiness: database and Redis reachable) for monitoring and load balancers; see the configuration guide.

πŸ“– API Documentation

API documentation is generated from Swaggo annotations on the handlers and checked against the routes actually registered by Hertz. The root ppanel.json is the complete Swagger 2.0 document:

ppanel.json

After changing a route, request DTO, or response DTO, run:

./script/generate-swagger.sh
go test ./internal/transport/http/routes -run '^TestSwagger' -count=1

GitHub Actions on master generates the full document plus the admin.json, user.json, common.json, and node.json scopes, then syncs them to docs/public/swagger in perfect-panel/frontend. The GH_TOKEN secret needs Contents write access to that repository.

Project Description Link
PPanel Web Frontend for PPanel GitHub
PPanel User Web User interface for PPanel Preview
PPanel Admin Web Admin interface for PPanel Preview

🌐 Official Website

Visit ppanel.dev for more details.

πŸ› Architecture

Architecture Diagram

πŸ“ Directory Structure

.
β”œβ”€β”€ cmd/              # Application entry point
β”œβ”€β”€ docs/             # Documentation
β”œβ”€β”€ etc/              # Configuration files (e.g., ppanel.yaml)
β”œβ”€β”€ internal/         # Internal modules
β”‚   β”œβ”€β”€ app/          # Assembly, bootstrap, migrations and scheduling
β”‚   β”œβ”€β”€ arch/         # Architecture boundary checks
β”‚   β”œβ”€β”€ auth/         # Shared authentication capabilities
β”‚   β”œβ”€β”€ config/       # Configuration parsing
β”‚   β”œβ”€β”€ infra/        # Mail, SMS, shared task messages and infrastructure
β”‚   β”œβ”€β”€ module/       # Business facades, contracts, entities and adapters
β”‚   β”œβ”€β”€ repository/   # Repository contracts and transaction assembly
β”‚   └── transport/    # HTTP, WebSocket and task consumers
β”œβ”€β”€ pkg/              # Utility code
β”œβ”€β”€ script/           # Installation and CI helper scripts
β”œβ”€β”€ scripts/          # Performance and maintenance scripts
β”œβ”€β”€ go.mod            # Go module definition
β”œβ”€β”€ Makefile          # Build automation
└── Dockerfile        # Docker configuration

πŸ’» Development

Build for Multiple Platforms

Use the Makefile to build for various platforms (e.g., Linux, Windows, macOS):

make all  # Builds linux-amd64, darwin-amd64, windows-amd64
make linux-arm64  # Build for specific platform

Every binary is static (CGO_ENABLED=0 -trimpath), built with the metadata from script/ldflags.sh. The release publishes ppanel-server-<os>-<arch>.tar.gz (.zip for Windows) with a SHA256SUMS file for:

  • Linux: 386, amd64, arm64 (plus the linux/amd64 and linux/arm64 container images)
  • Windows: 386, amd64, arm64
  • macOS: amd64, arm64

make additionally builds linux-amd64-v3, linux-armv5, linux-armv6, linux-armv7, windows-amd64-v3, windows-armv7 and darwin-amd64-v3.

πŸ”’ Security

Report vulnerabilities privately through GitHub Security Advisories, not in public issues. SECURITY.md lists the supported versions and what to expect.

🀝 Contributing

Contributions are welcome! Please follow the Contribution Guidelines for bug fixes, features, or documentation improvements.

✨ Special Thanks

A huge thank you to the following outstanding open-source projects that have provided invaluable support for this project's development! πŸš€

Project Description Project Description
Hertz
Hertz Stars
High-performance Go HTTP framework
Gorm
Gorm
Gorm Stars
Powerful Go ORM framework
Asynq
Asynq
Asynq Stars
Asynchronous task queue for Go
Go-Swagger
Go-Swagger
Go-Swagger Stars
Comprehensive Go Swagger toolkit

πŸŽ‰ Salute to Open Source: Thank you to the open-source community for making development simpler and more efficient! Please give these projects a ⭐ to support the open-source movement!

πŸ“„ License

This project is licensed under the GPL-3.0 License.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
api
Package cmd is the PPanel command line: run starts the server, first the setup wizard when the configuration is incomplete; migrate holds the database migration tools; version prints the build.
Package cmd is the PPanel command line: run starts the server, first the setup wizard when the configuration is incomplete; migrate holds the database migration tools; version prints the build.
internal
app
Package app is the composition root.
Package app is the composition root.
app/bootstrap
Package bootstrap loads the runtime configuration at startup and reloads a subsystem's part of it when an administrator changes its settings: it runs the database migration, seeds the first administrator, provisions the node secret and publishes each subsystem's stored settings (site, node, email, device, invite, verification, subscription, registration, mobile, currency and Telegram) into the process's runtime snapshot.
Package bootstrap loads the runtime configuration at startup and reloads a subsystem's part of it when an administrator changes its settings: it runs the database migration, seeds the first administrator, provisions the node secret and publishes each subsystem's stored settings (site, node, email, device, invite, verification, subscription, registration, mobile, currency and Telegram) into the process's runtime snapshot.
app/buildinfo
Package buildinfo holds the version, build time and release channel the build scripts inject, for the CLI and the admin version endpoint.
Package buildinfo holds the version, build time and release channel the build scripts inject, for the CLI and the admin version endpoint.
app/lifecycle
Package lifecycle runs the process's services as one group: started together and stopped once, in the reverse order they were added, with the log output closed last so the lines written while stopping reach the log files.
Package lifecycle runs the process's services as one group: started together and stopped once, in the reverse order they were added, with the log output closed last so the lines written while stopping reach the log files.
app/migration/mysql2postgres
Package mysql2postgres copies the data of a MySQL or MariaDB installation into a PostgreSQL database whose schema the migrations created: the rows of the tables and columns both databases have, in foreign-key order, for the migrate mysql2postgres command.
Package mysql2postgres copies the data of a MySQL or MariaDB installation into a PostgreSQL database whose schema the migrations created: the rows of the tables and columns both databases have, in foreign-key order, for the migrate mysql2postgres command.
app/migration/schema
Package schema migrates the database schema with the SQL migrations of both dialects embedded in the binary, and seeds the first administrator of a fresh installation.
Package schema migrates the database schema with the SQL migrations of both dialects embedded in the binary, and seeds the first administrator of a fresh installation.
app/scheduler
Package scheduler enqueues the periodic tasks on their schedules, in the application's time zone.
Package scheduler enqueues the periodic tasks on their schedules, in the application's time zone.
app/state
Package state owns the process-wide mutable runtime state.
Package state owns the process-wide mutable runtime state.
auth/challenge
Package challenge verifies Cloudflare Turnstile tokens, the human check guarding sign-in, registration, password resets and guest purchases.
Package challenge verifies Cloudflare Turnstile tokens, the human check guarding sign-in, registration, password resets and guest purchases.
auth/deviceauth
Package deviceauth authenticates the optional device transport envelope.
Package deviceauth authenticates the optional device transport envelope.
auth/devicesession
Package devicesession supplies per-device session generations.
Package devicesession supplies per-device session generations.
auth/identifier
Package identifier normalizes and validates the identifiers accounts sign in with: email addresses, phone numbers and device identifiers.
Package identifier normalizes and validates the identifiers accounts sign in with: email addresses, phone numbers and device identifiers.
auth/password
Package password hashes account passwords with argon2id and checks sign-in attempts against the stored hash.
Package password hashes account passwords with argon2id and checks sign-in attempts against the stored hash.
auth/ratelimit
Package ratelimit grants a limited number of permits per key and period.
Package ratelimit grants a limited number of permits per key and period.
auth/token
Package token signs and parses the HS256 JSON Web Tokens the server hands out: the session tokens of package usersession and billing's order event tickets.
Package token signs and parses the HS256 JSON Web Tokens the server hands out: the session tokens of package usersession and billing's order event tickets.
auth/usersession
Package usersession issues, validates and ends user sessions.
Package usersession issues, validates and ends user sessions.
config
Package config defines the server's configuration: Config, whose boot half is read from the configuration file at start-up and whose runtime half administrators edit in the system settings table; the decoding of stored settings into those structs; the Redis keys several modules share; and the Redis helpers of start-up and installation.
Package config defines the server's configuration: Config, whose boot half is read from the configuration file at start-up and whose runtime half administrators edit in the system settings table; the decoding of stored settings into those structs; the Redis keys several modules share; and the Redis helpers of start-up and installation.
infra/eventbus
Package eventbus is the domain-event bus riding the asynq message queue (ADR-001 step-6 preparation).
Package eventbus is the domain-event bus riding the asynq message queue (ADR-001 step-6 preparation).
infra/geoip
Package geoip reads the local MaxMind GeoLite2 databases and derives the country, region, city and network of a client IP for the request metadata the logs and audit records carry.
Package geoip reads the local MaxMind GeoLite2 databases and derives the country, region, city and network of a client IP for the request metadata the logs and audit records carry.
infra/geoip/geoiptest
Package geoiptest builds minimal MaxMind databases for tests, so code that reads GeoIP data can be tested without the real (downloaded) databases.
Package geoiptest builds minimal MaxMind databases for tests, so code that reads GeoIP data can be tested without the real (downloaded) databases.
infra/integration
Package integration defines provider metadata shared by payment and messaging integrations.
Package integration defines provider metadata shared by payment and messaging integrations.
infra/mail
Package mail sends the application's email through the provider the administrators configure; SMTP is the one provider.
Package mail sends the application's email through the provider the administrators configure; SMTP is the one provider.
infra/mapping
Package mapping copies between the entity, contract and DTO structs of the same data by field name, with the conversions the API needs: a time.Time becomes int64 Unix milliseconds, the form the JSON responses carry.
Package mapping copies between the entity, contract and DTO structs of the same data by field name, with the conversions the API needs: a time.Time becomes int64 Unix milliseconds, the form the JSON responses carry.
infra/protocolkey
Package protocolkey preserves the key and short-identifier encodings used by external protocols.
Package protocolkey preserves the key and short-identifier encodings used by external protocols.
infra/requestctx
Package requestctx defines the keys under which the HTTP middleware stores what it learned about a request (the signed-in user, the session, the payment method of a callback) in the request context.
Package requestctx defines the keys under which the HTTP middleware stores what it learned about a request (the signed-in user, the session, the payment method of a callback) in the request context.
infra/sms
Package sms sends text messages, verification codes above all, through the provider the administrators configure.
Package sms sends text messages, verification codes above all, through the provider the administrators configure.
infra/sms/abosend
Package abosend sends text messages through the Abosend HTTP API.
Package abosend sends text messages through the Abosend HTTP API.
infra/sms/alibabacloud
Package alibabacloud sends text messages through Alibaba Cloud SMS, which fills a template approved on the provider's side.
Package alibabacloud sends text messages through Alibaba Cloud SMS, which fills a template approved on the provider's side.
infra/sms/smsbao
Package smsbao sends text messages through the SMSBao HTTP API.
Package smsbao sends text messages through the SMSBao HTTP API.
infra/sms/twilio
Package twilio sends text messages through the Twilio API.
Package twilio sends text messages through the Twilio API.
infra/taskqueue
Package taskqueue is what the producers and the consumers of the asynq task queue share: the task type names, the payloads, the task IDs that deduplicate enqueues, and the client and worker middleware that carry the OpenTelemetry trace context across the queue.
Package taskqueue is what the producers and the consumers of the asynq task queue share: the task type names, the payloads, the task IDs that deduplicate enqueues, and the client and worker middleware that carry the OpenTelemetry trace context across the queue.
module/billing
Package billing is the facade of the billing module: orders and their checkout, payment methods and gateway callbacks, coupons, the V2 order orchestration with its event stream, the wallet and the paid-order activation workflow (ADR-001).
Package billing is the facade of the billing module: orders and their checkout, payment methods and gateway callbacks, coupons, the V2 order orchestration with its event stream, the wallet and the paid-order activation workflow (ADR-001).
module/billing/contract
Package dto is the billing module's contract: the commands, queries and results of its facade and HTTP handlers, and the billing-owned read-only snapshots of other domains' data it returns.
Package dto is the billing module's contract: the commands, queries and results of its facade and HTTP handlers, and the billing-owned read-only snapshots of other domains' data it returns.
module/billing/entity/coupon
Package coupon holds the billing domain's coupon entity: a discount code with its validity window, usage limits and the plans it applies to.
Package coupon holds the billing domain's coupon entity: a discount code with its validity window, usage limits and the plans it applies to.
module/billing/entity/order
Package order holds the billing domain's order entities and the rules that travel with them: the order and its details, the status state machine, order numbers, the durable order events and their wake-up channels, and the guest checkout data an order carries until the guest's account exists.
Package order holds the billing domain's order entities and the rules that travel with them: the order and its details, the status state machine, order numbers, the durable order events and their wake-up channels, and the guest checkout data an order carries until the guest's account exists.
module/billing/entity/payment
Package payment holds the billing domain's payment method entity and the stored configuration of each gateway it can be bound to.
Package payment holds the billing domain's payment method entity and the stored configuration of each gateway it can be bound to.
module/billing/entity/wallet
Package wallet holds the billing domain's money entities: the wallet row (the single source of truth for balance/gift/commission since migration 02144) and withdrawal records (ADR-001 step 5).
Package wallet holds the billing domain's money entities: the wallet row (the single source of truth for balance/gift/commission since migration 02144) and withdrawal records (ADR-001 step 5).
module/billing/internal/activation
Package activation owns the paid-order activation workflow and implements its billing-domain stages: the recharge wallet credit, the referral commission and the final settlement.
Package activation owns the paid-order activation workflow and implements its billing-domain stages: the recharge wallet credit, the referral commission and the final settlement.
module/billing/internal/adminorder
Package adminorder implements the admin-side order management subdomain of the billing module.
Package adminorder implements the admin-side order management subdomain of the billing module.
module/billing/internal/adminpayment
Package adminpayment implements the payment-method management subdomain of the billing module.
Package adminpayment implements the payment-method management subdomain of the billing module.
module/billing/internal/billingtest
Package billingtest provides the billing module's behaviour-test harness: the real repository store over a private SQLite database and a miniredis instance, with seeding helpers for the rows order flows read.
Package billingtest provides the billing module's behaviour-test harness: the real repository store over a private SQLite database and a miniredis instance, with seeding helpers for the rows order flows read.
module/billing/internal/callbacks
Package callbacks implements the payment gateway callback subdomain of the billing module: it authenticates gateway notifications, verifies them against the order's immutable payment expectation, re-confirms with the gateway and settles the payment.
Package callbacks implements the payment gateway callback subdomain of the billing module: it authenticates gateway notifications, verifies them against the order's immutable payment expectation, re-confirms with the gateway and settles the payment.
module/billing/internal/checkout
Package checkout implements the user-facing money flows of the billing module: purchase, renewal, traffic reset, recharge, order preview and close.
Package checkout implements the user-facing money flows of the billing module: purchase, renewal, traffic reset, recharge, order preview and close.
module/billing/internal/coupon
Package coupon implements the coupon management subdomain of the billing module.
Package coupon implements the coupon management subdomain of the billing module.
module/billing/internal/exchangerate
Package exchangerate converts the site currency for gateways that collect another one: the apilayer conversion API and the cache of the refreshed CNY rate that checkout reads first.
Package exchangerate converts the site currency for gateways that collect another one: the apilayer conversion API and the cache of the refreshed CNY rate that checkout reads first.
module/billing/internal/gateway
Package gateway is the billing module's single seam onto payment gateways.
Package gateway is the billing module's single seam onto payment gateways.
module/billing/internal/ledger
Package ledger writes the wallet movement records of the billing module: every gift-credit and balance change an order makes is recorded here, with the same shape, timestamp and remark vocabulary.
Package ledger writes the wallet movement records of the billing module: every gift-credit and balance change an order makes is recorded here, with the same shape, timestamp and remark vocabulary.
module/billing/internal/orderaudit
Package orderaudit writes the durable audit record created alongside an order.
Package orderaudit writes the durable audit record created alongside an order.
module/billing/internal/ordercontext
Package ordercontext carries the idempotency metadata of a V2 order creation through the request context into the order creators V1 and V2 share; a V1 request carries none.
Package ordercontext carries the idempotency metadata of a V2 order creation through the request context into the order creators V1 and V2 share; a V1 request carries none.
module/billing/internal/orderevents
Package orderevents runs billing's order-event outbox.
Package orderevents runs billing's order-event outbox.
module/billing/internal/payment
Package payment holds what every payment gateway protocol shares: the supported platforms and their names, and the money conversions between the minor units orders count and the decimal amounts gateways exchange.
Package payment holds what every payment gateway protocol shares: the supported platforms and their names, and the money conversions between the minor units orders count and the decimal amounts gateways exchange.
module/billing/internal/payment/alipay
Package alipay implements the Alipay face-to-face payment protocol: QR code trade creation, trade query and close, and signed notification decoding.
Package alipay implements the Alipay face-to-face payment protocol: QR code trade creation, trade query and close, and signed notification decoding.
module/billing/internal/payment/cryptomus
Package cryptomus implements the Cryptomus crypto-payment gateway protocol: invoice creation, invoice lookup and webhook signature verification.
Package cryptomus implements the Cryptomus crypto-payment gateway protocol: invoice creation, invoice lookup and webhook signature verification.
module/billing/internal/payment/epay
Package epay implements the EPay payment protocol: signed payment URLs, callback signature verification and the order query, with the EasyPay-compatible query as a fallback.
Package epay implements the EPay payment protocol: signed payment URLs, callback signature verification and the order query, with the EasyPay-compatible query as a fallback.
module/billing/internal/payment/epay/protocol
Package protocol implements EPay V1 and V2 using Go's standard library.
Package protocol implements EPay V1 and V2 using Go's standard library.
module/billing/internal/payment/stripe
Package stripe implements the Stripe payment protocol: payment intents and their payment sheets, customers, webhook endpoints and signed webhook events.
Package stripe implements the Stripe payment protocol: payment intents and their payment sheets, customers, webhook endpoints and signed webhook events.
module/billing/internal/portal
Package portal implements the guest storefront subdomain of the billing module: guest pre-orders, gateway/balance checkout, order status polling with session exchange, and the public plan/payment listings.
Package portal implements the guest storefront subdomain of the billing module: guest pre-orders, gateway/balance checkout, order status polling with session exchange, and the public plan/payment listings.
module/billing/internal/pricing
Package pricing decides what an order costs.
Package pricing decides what an order costs.
module/billing/internal/repo
Package repo holds the billing module's repository implementations over GORM: orders with their event outbox, payment methods, coupons, and the wallet and withdrawal rows.
Package repo holds the billing module's repository implementations over GORM: orders with their event outbox, payment methods, coupons, and the wallet and withdrawal rows.
module/billing/internal/settle
Package settle holds the one settlement primitive shared by the checkout and payment-callback subdomains: marking a gateway-verified payment as paid and enqueueing activation.
Package settle holds the one settlement primitive shared by the checkout and payment-callback subdomains: marking a gateway-verified payment as paid and enqueueing activation.
module/billing/internal/userorder
Package userorder implements the user-facing order query subdomain of the billing module.
Package userorder implements the user-facing order query subdomain of the billing module.
module/billing/internal/v2
Package v2 implements the V2 order orchestration subdomain of the billing module: idempotent create-and-checkout, guest checkout capabilities, the SSE event-stream tickets and the event stream itself.
Package v2 implements the V2 order orchestration subdomain of the billing module: idempotent create-and-checkout, guest checkout capabilities, the SSE event-stream tickets and the event stream itself.
module/billing/internal/wallet
Package wallet implements the wallet subdomain of the billing module: the user-facing commission withdrawal, balance/commission statements and affiliate earnings overview, and the wallet reads and money movements other modules request from billing (ADR-001 rules 2 and 4) β€” the administrator's wallet edits, cancellation refunds and quota-task gifts, each committed in a billing transaction of its own.
Package wallet implements the wallet subdomain of the billing module: the user-facing commission withdrawal, balance/commission statements and affiliate earnings overview, and the wallet reads and money movements other modules request from billing (ADR-001 rules 2 and 4) β€” the administrator's wallet edits, cancellation refunds and quota-task gifts, each committed in a billing transaction of its own.
module/billing/transport/http
Package handler registers the billing module's payment gateway callback routes.
Package handler registers the billing module's payment gateway callback routes.
module/billing/transport/http/admin/coupon
Package coupon holds the HTTP handlers of the admin coupon API; they adapt requests to the billing facade.
Package coupon holds the HTTP handlers of the admin coupon API; they adapt requests to the billing facade.
module/billing/transport/http/admin/order
Package order holds the HTTP handlers of the admin order API; they adapt requests to the billing facade.
Package order holds the HTTP handlers of the admin order API; they adapt requests to the billing facade.
module/billing/transport/http/admin/payment
Package payment holds the HTTP handlers of the admin payment method API; they adapt requests to the billing facade.
Package payment holds the HTTP handlers of the admin payment method API; they adapt requests to the billing facade.
module/billing/transport/http/admin/withdrawal
Package withdrawal holds the HTTP handlers of the admin commission withdrawal review API; they adapt requests to the billing facade.
Package withdrawal holds the HTTP handlers of the admin commission withdrawal review API; they adapt requests to the billing facade.
module/billing/transport/http/notify
Package notify holds the HTTP handler that receives payment gateway callbacks and hands them to the billing facade to authenticate and settle.
Package notify holds the HTTP handler that receives payment gateway callbacks and hands them to the billing facade to authenticate and settle.
module/billing/transport/http/public/order
Package order holds the HTTP handlers of the user order API, V1 and the V2 create-and-checkout orchestration with its event stream; they adapt requests to the billing facade.
Package order holds the HTTP handlers of the user order API, V1 and the V2 create-and-checkout orchestration with its event stream; they adapt requests to the billing facade.
module/billing/transport/http/public/payment
Package payment holds the HTTP handler listing the payment methods a signed-in user can pay with.
Package payment holds the HTTP handler listing the payment methods a signed-in user can pay with.
module/billing/transport/http/public/portal
Package portal holds the HTTP handlers of the guest storefront API: plans, payment methods, guest orders, their checkout and status; they adapt requests to the billing facade.
Package portal holds the HTTP handlers of the guest storefront API: plans, payment methods, guest orders, their checkout and status; they adapt requests to the billing facade.
module/billing/transport/http/public/user
Package user holds the HTTP handlers of the user wallet API: commission withdrawal, balance, commission and withdrawal statements, and the affiliate overview; they adapt requests to the billing facade.
Package user holds the HTTP handlers of the user wallet API: commission withdrawal, balance, commission and withdrawal statements, and the affiliate overview; they adapt requests to the billing facade.
module/identity
Package identity is the facade of the identity module: accounts, their sign-in identities and devices, the authentication and OAuth flows, the verification codes and the admin management of accounts and authentication methods.
Package identity is the facade of the identity module: accounts, their sign-in identities and devices, the authentication and OAuth flows, the verification codes and the admin management of accounts and authentication methods.
module/identity/contract
Package dto holds the identity module's contract: the request and response types of its facade and HTTP handlers.
Package dto holds the identity module's contract: the request and response types of its facade and HTTP handlers.
module/identity/entity/auth
Package auth holds the identity module's authentication-method entities: the stored configuration of each sign-in method and the purposes of verification codes.
Package auth holds the identity module's authentication-method entities: the stored configuration of each sign-in method and the purposes of verification codes.
module/identity/entity/user
Package user holds the identity module's account entities: the user row, its sign-in identities, devices and their online records, the filters of the account queries, and the account's cache keys and request context.
Package user holds the identity module's account entities: the user row, its sign-in identities, devices and their online records, the filters of the account queries, and the account's cache keys and request context.
module/identity/internal/account
Package account holds what every account-creating and sign-in flow of the identity module shares: creating an account with its identities, the registration event and audit, the login audit, the account state check and the session a sign-in ends with.
Package account holds what every account-creating and sign-in flow of the identity module shares: creating an account with its identities, the registration event and audit, the login audit, the account state check and the session a sign-in ends with.
module/identity/internal/adminuser
Package adminuser implements the admin-side account management subdomain of the identity module: user CRUD, auth methods, devices and login logs.
Package adminuser implements the admin-side account management subdomain of the identity module: user CRUD, auth methods, devices and login logs.
module/identity/internal/authmethodadmin
Package authmethodadmin implements the admin-side authentication-method subdomain of the identity module: method configuration, sender platforms and test sends.
Package authmethodadmin implements the admin-side authentication-method subdomain of the identity module: method configuration, sender platforms and test sends.
module/identity/internal/authn
Package authn implements the authentication subdomain of the identity module: account existence checks, password, code and device sign-in, registration, password resets and, through its oauth subpackage, OAuth sign-in.
Package authn implements the authentication subdomain of the identity module: account existence checks, password, code and device sign-in, registration, password resets and, through its oauth subpackage, OAuth sign-in.
module/identity/internal/authn/oauth
Package oauth implements OAuth sign-in: the authorization URL, the callback that signs an existing account in or registers a new one, and Apple's form-post callback.
Package oauth implements OAuth sign-in: the authorization URL, the callback that signs an existing account in or registers a new one, and Apple's form-post callback.
module/identity/internal/authn/registerpolicy
Package registerpolicy enforces the administrator-configured account policies shared by every authentication and registration path.
Package registerpolicy enforces the administrator-configured account policies shared by every authentication and registration path.
module/identity/internal/devicestate
Package devicestate owns consistent device removal shared by user and admin entry points.
Package devicestate owns consistent device removal shared by user and admin entry points.
module/identity/internal/guestaccount
Package guestaccount owns the account-creation stage of paid guest orders.
Package guestaccount owns the account-creation stage of paid guest orders.
module/identity/internal/identitytest
Package identitytest runs the identity module's real repositories over an in-memory SQLite database and miniredis, for behaviour tests that check what a flow wrote rather than which dependency it called.
Package identitytest runs the identity module's real repositories over an in-memory SQLite database and miniredis, for behaviour tests that check what a flow wrote rather than which dependency it called.
module/identity/internal/oauthflow
Package oauthflow runs the provider round trip OAuth sign-in and account binding share: the authorization URL with its state, and the callback that redeems the state and turns into the identity the provider vouches for.
Package oauthflow runs the provider round trip OAuth sign-in and account binding share: the authorization URL with its state, and the callback that redeems the state and turns into the identity the provider vouches for.
module/identity/internal/oauthprovider
Package oauthprovider defines the OAuth sign-in methods: a Provider builds the authorization URL of one method and turns its callback into the identity the provider vouches for.
Package oauthprovider defines the OAuth sign-in methods: a Provider builds the authorization URL of one method and turns its callback into the identity the provider vouches for.
module/identity/internal/oauthprovider/apple
Package apple is the Sign in with Apple client of the Apple sign-in method: it signs the client secret from the configured private key and exchanges authorization codes for the identity token.
Package apple is the Sign in with Apple client of the Apple sign-in method: it signs the client secret from the configured private key and exchanges authorization codes for the identity token.
module/identity/internal/oauthprovider/facebook
Package facebook is the Graph API client of the Facebook sign-in method: the OAuth endpoints and the profile of the signed-in user.
Package facebook is the Graph API client of the Facebook sign-in method: the OAuth endpoints and the profile of the signed-in user.
module/identity/internal/oauthprovider/github
Package github is the GitHub API client of the GitHub sign-in method: the profile of the signed-in user and their verified email address.
Package github is the GitHub API client of the GitHub sign-in method: the profile of the signed-in user and their verified email address.
module/identity/internal/oauthprovider/google
Package google is the Google client of the Google sign-in method: the OAuth configuration and the profile of the signed-in user.
Package google is the Google client of the Google sign-in method: the OAuth configuration and the profile of the signed-in user.
module/identity/internal/oauthprovider/telegram
Package telegram verifies the signed result of the Telegram Login Widget for the Telegram sign-in method and builds the widget's authorization URL.
Package telegram verifies the signed result of the Telegram Login Widget for the Telegram sign-in method and builds the widget's authorization URL.
module/identity/internal/oauthstate
Package oauthstate owns the OAuth state round trip: the state issued with an authorization URL, stored with the redirect and the purpose it belongs to, and redeemed once by the callback of that purpose.
Package oauthstate owns the OAuth state round trip: the state issued with an authorization URL, stored with the redirect and the purpose it belongs to, and redeemed once by the callback of that purpose.
module/identity/internal/profile
Package profile implements the self-service identity subdomain of the identity module: account info, credentials, third-party bindings, devices and notification preferences.
Package profile implements the self-service identity subdomain of the identity module: account info, credentials, third-party bindings, devices and notification preferences.
module/identity/internal/repo
Package repo holds the identity module's repository implementations: the user account rows, auth methods, devices and the cross-domain cache facade (ADR-001 step-6 preparation).
Package repo holds the identity module's repository implementations: the user account rows, auth methods, devices and the cross-domain cache facade (ADR-001 step-6 preparation).
module/identity/internal/startup
Package startup implements the identity module's part of the server start: seeding the first administrator of a fresh database, finding the administrators still signing in with a published default password, and the check and data fix-up that run once the schema is current.
Package startup implements the identity module's part of the server start: seeding the first administrator of a fresh database, finding the administrators still signing in with a published default password, and the check and data fix-up that run once the schema is current.
module/identity/internal/verification
Package verification stores and checks the email and SMS verification codes of the identity module in Redis: the code of one identifier and purpose, and the guesses made against it.
Package verification stores and checks the email and SMS verification codes of the identity module in Redis: the code of one identifier and purpose, and the guesses made against it.
module/identity/internal/verifycode
Package verifycode implements the verification-code subdomain of the identity module: issuing and pre-checking the email and SMS codes that gate registration and account mutations.
Package verifycode implements the verification-code subdomain of the identity module: issuing and pre-checking the email and SMS codes that gate registration and account mutations.
module/identity/transport/http/admin/authmethod
Package authmethod holds the identity module's admin handlers of the authentication methods: their configuration, the sender platforms and the test sends.
Package authmethod holds the identity module's admin handlers of the authentication methods: their configuration, the sender platforms and the test sends.
module/identity/transport/http/admin/user
Package user holds the identity module's admin handlers of the accounts: user CRUD, identities, devices, login logs and notification settings.
Package user holds the identity module's admin handlers of the accounts: user CRUD, identities, devices, login logs and notification settings.
module/identity/transport/http/auth
Package auth holds the identity module's handlers of the sign-in, registration and password-reset endpoints under /v1/auth.
Package auth holds the identity module's handlers of the sign-in, registration and password-reset endpoints under /v1/auth.
module/identity/transport/http/auth/oauth
Package oauth holds the identity module's handlers of OAuth sign-in: the authorization URL, the token exchange and Apple's form-post callback.
Package oauth holds the identity module's handlers of OAuth sign-in: the authorization URL, the token exchange and Apple's form-post callback.
module/identity/transport/http/common
Package common holds the identity module's handlers of the verification codes: sending email and SMS codes and pre-checking them.
Package common holds the identity module's handlers of the verification codes: sending email and SMS codes and pre-checking them.
module/identity/transport/http/public/user
Package user holds the identity module's self-service handlers of the signed-in account: its profile, credentials, bindings, devices and notification settings.
Package user holds the identity module's self-service handlers of the signed-in account: its profile, credentials, bindings, devices and notification settings.
module/network
Package network is the facade of the network module: admin-side server and node management, the node-facing server API and the edge client manifest.
Package network is the facade of the network module: admin-side server and node management, the node-facing server API and the edge client manifest.
module/network/contract
Package dto is the network module's contract: the requests and responses of the admin server and node management, the node-facing server API and the edge manifest.
Package dto is the network module's contract: the requests and responses of the admin server and node management, the node-facing server API and the edge manifest.
module/network/entity/node
Package node holds the network module's server and node entities: the servers with the protocols they offer, stored as JSON and normalized for storage and distribution, the nodes that expose them, the per-server node configuration overrides, and the Redis keys of the node-facing caches.
Package node holds the network module's server and node entities: the servers with the protocols they offer, stored as JSON and normalized for storage and distribution, the nodes that expose them, the per-server node configuration overrides, and the Redis keys of the node-facing caches.
module/network/entity/traffic
Package traffic holds the network module's traffic log entity, the per-server and per-subscription usage rows the traffic pipeline writes, and the aggregates read from it.
Package traffic holds the network module's traffic log entity, the per-server and per-subscription usage rows the traffic pipeline writes, and the aggregates read from it.
module/network/internal/adminserver
Package adminserver is the network module's admin-side management of the servers and nodes: their creation, updates and removal, their sort order, the protocols a server offers and its node configuration overrides, and the node-facing caches these changes invalidate.
Package adminserver is the network module's admin-side management of the servers and nodes: their creation, updates and removal, their sort order, the protocols a server offers and its node configuration overrides, and the node-facing caches these changes invalidate.
module/network/internal/edge
Package edge is the network module's edge subdomain: the manifest a trusted edge-subscribe Worker fetches for a subscription token, listing the subscription's state and the proxies of its plan's nodes.
Package edge is the network module's edge subdomain: the manifest a trusted edge-subscribe Worker fetches for a subscription token, listing the subscription's state and the proxies of its plan's nodes.
module/network/internal/edgeauth
Package edgeauth authenticates Cloudflare edge-subscribe Workers.
Package edgeauth authenticates Cloudflare edge-subscribe Workers.
module/network/internal/geolocation
Package geolocation locates a server address through public IP geolocation services, filling in a server's country and city.
Package geolocation locates a server address through public IP geolocation services, filling in a server's country and city.
module/network/internal/multiplier
Package multiplier applies the node traffic multipliers an administrator sets for times of day.
Package multiplier applies the node traffic multipliers an administrator sets for times of day.
module/network/internal/nodeconfig
Package nodeconfig resolves the node configuration a server's nodes run with: the global node settings and the server's override of them, whose fields each either inherit (NULL) or replace a global value.
Package nodeconfig resolves the node configuration a server's nodes run with: the global node settings and the server's override of them, whose fields each either inherit (NULL) or replace a global value.
module/network/internal/protocolmap
Package protocolmap is the one mapping between a server protocol as stored (node.Protocol, the servers.protocols JSON) and as the API shows it (dto.Protocol).
Package protocolmap is the one mapping between a server protocol as stored (node.Protocol, the servers.protocols JSON) and as the API shows it (dto.Protocol).
module/network/internal/repo
Package repo holds the network module's repository implementations: the servers and nodes with their Redis caches, and the traffic log.
Package repo holds the network module's repository implementations: the servers and nodes with their Redis caches, and the traffic log.
module/network/internal/serverapi
Package serverapi is the network module's node-facing server API: the configuration and user lists the nodes pull, cached per server and negotiated with ETags, and the status, online-user and traffic reports they push.
Package serverapi is the network module's node-facing server API: the configuration and user lists the nodes pull, cached per server and negotiated with ETags, and the status, online-user and traffic reports they push.
module/network/internal/trafficagg
Package trafficagg is the network module's traffic pipeline.
Package trafficagg is the network module's traffic pipeline.
module/network/internal/trafficstat
Package trafficstat keeps the records derived from the raw traffic log: the daily traffic statistics the dashboard and the admin log views read, and the retention of the raw log itself.
Package trafficstat keeps the records derived from the raw traffic log: the daily traffic statistics the dashboard and the admin log views read, and the retention of the raw log itself.
module/network/transport/http/admin/server
Package server holds the admin HTTP handlers of the server and node management.
Package server holds the admin HTTP handlers of the server and node management.
module/network/transport/http/edge
Package edge holds the HTTP handler of the edge manifest, authenticated by the edge credential.
Package edge holds the HTTP handler of the edge manifest, authenticated by the edge credential.
module/network/transport/http/server
Package server holds the HTTP handlers of the node-facing server API, authenticated by the node secret and answering in JSON or Protobuf.
Package server holds the HTTP handlers of the node-facing server API, authenticated by the node secret and answering in JSON or Protobuf.
module/notification
Package notification is the facade of the notification module's Telegram bot: update handling (webhook and polling), the administrators' group and its topics, user and administrator notices, the webhook secret and the message templates other domains render.
Package notification is the facade of the notification module's Telegram bot: update handling (webhook and polling), the administrators' group and its topics, user and administrator notices, the webhook secret and the message templates other domains render.
module/notification/entity/telegramtopic
Package telegramtopic maps forum topics in the administrators' Telegram group to what they carry.
Package telegramtopic maps forum topics in the administrators' Telegram group to what they carry.
module/notification/internal/repo
Package repo holds the notification module's repository implementation: the mapping of forum topics in the administrators' Telegram group.
Package repo holds the notification module's repository implementation: the mapping of forum topics in the administrators' Telegram group.
module/notification/internal/telegram
Package telegram implements the notification module's Telegram bot: the routing of updates, account binding and the traffic report in private chats, the administrator commands and the support and ticket topics of the administrators' group, and the MarkdownV2 message templates.
Package telegram implements the notification module's Telegram bot: the routing of updates, account binding and the traffic report in private chats, the administrator commands and the support and ticket topics of the administrators' group, and the MarkdownV2 message templates.
module/notification/transport/http
Package handler holds the Hertz handler of the Telegram bot webhook.
Package handler holds the Hertz handler of the Telegram bot webhook.
module/platform
Package platform is the facade of the platform module, the shared kernel: audit and message logs with their retention settings, the system settings, the admin console dashboard and tools, and the unauthenticated site-level reads of the public portal.
Package platform is the facade of the platform module, the shared kernel: audit and message logs with their retention settings, the system settings, the admin console dashboard and tools, and the unauthenticated site-level reads of the public portal.
module/platform/contract
Package dto holds the platform module's contract: the requests and responses of the audit log, system settings, admin console, admin tool and public site endpoints.
Package dto holds the platform module's contract: the requests and responses of the audit log, system settings, admin console, admin tool and public site endpoints.
module/platform/entity/inbox
Package inbox holds the idempotent-consumer inbox row: the marker a domain step records, inside its own transaction, for every event it has processed, so a redelivered event is skipped (ADR-001 step 2).
Package inbox holds the idempotent-consumer inbox row: the marker a domain step records, inside its own transaction, for every event it has processed, so a redelivered event is skipped (ADR-001 step 2).
module/platform/entity/log
Package log holds the system log row (the system_logs table) and the typed content of each kind of entry: the message and subscription logs, the login, registration, balance, commission, gift and order logs, and the traffic logs, rankings and daily statistics.
Package log holds the system log row (the system_logs table) and the typed content of each kind of entry: the message and subscription logs, the login, registration, balance, commission, gift and order logs, and the traffic logs, rankings and daily statistics.
module/platform/entity/outbox
Package outbox holds the generic domain-event outbox row (ADR-001 step-6 preparation): appended in the owning domain's transaction, published onto the asynq queue by the dispatch pump, consumed idempotently via the inbox.
Package outbox holds the generic domain-event outbox row (ADR-001 step-6 preparation): appended in the owning domain's transaction, published onto the asynq queue by the dispatch pump, consumed idempotently via the inbox.
module/platform/entity/system
Package system holds the system settings row (the system table), one stored value per setting, and the parsing of the node settings kept in it.
Package system holds the system settings row (the system table), one stored value per setting, and the parsing of the node settings kept in it.
module/platform/entity/task
Package task holds the task bookkeeping rows (the task and task_error tables) and the scope and content of the batch email and quota gift tasks they record.
Package task holds the task bookkeeping rows (the task and task_error tables) and the scope and content of the batch email and quota gift tasks they record.
module/platform/internal/auditlog
Package auditlog implements the audit/message log subdomain of the platform module: filtered views over the system log, message log listing and the log retention settings.
Package auditlog implements the audit/message log subdomain of the platform module: filtered views over the system log, message log listing and the log retention settings.
module/platform/internal/dashboard
Package dashboard implements the admin console subdomain of the platform module: cross-domain reporting aggregates.
Package dashboard implements the admin console subdomain of the platform module: cross-domain reporting aggregates.
module/platform/internal/publicinfo
Package publicinfo implements the public-info subdomain of the platform module: the unauthenticated site-level reads (global configuration, terms of service and privacy policy, aggregate statistics, client downloads, liveness).
Package publicinfo implements the public-info subdomain of the platform module: the unauthenticated site-level reads (global configuration, terms of service and privacy policy, aggregate statistics, client downloads, liveness).
module/platform/internal/readmodel
Package readmodel holds the platform's own views of other modules' data: the figures its dashboards, audit views and public statistics show.
Package readmodel holds the platform's own views of other modules' data: the figures its dashboards, audit views and public statistics show.
module/platform/internal/repo
Package repo holds the platform module's repository implementations: the system settings, cached in Redis, the system log, the task bookkeeping and the event inbox and outbox.
Package repo holds the platform module's repository implementations: the system settings, cached in Redis, the system log, the task bookkeeping and the event inbox and outbox.
module/platform/internal/systemsetting
Package systemsetting implements the system configuration subdomain of the platform module.
Package systemsetting implements the system configuration subdomain of the platform module.
module/platform/internal/tool
Package tool implements the admin tool subdomain of the platform module: the system log tail, the version, IP geolocation and the process restart.
Package tool implements the admin tool subdomain of the platform module: the system log tail, the version, IP geolocation and the process restart.
module/platform/transport/http/admin/console
Package console holds the Hertz handlers of the admin console dashboard: the revenue, user, traffic and ticket figures the platform facade computes.
Package console holds the Hertz handlers of the admin console dashboard: the revenue, user, traffic and ticket figures the platform facade computes.
module/platform/transport/http/admin/log
Package log holds the Hertz handlers of the admin audit and message log views and of the log retention settings.
Package log holds the Hertz handlers of the admin audit and message log views and of the log retention settings.
module/platform/transport/http/admin/system
Package system holds the Hertz handlers of the admin system settings: site, registration, verification, subscription, invitation, currency, terms, node and Telegram bot settings.
Package system holds the Hertz handlers of the admin system settings: site, registration, verification, subscription, invitation, currency, terms, node and Telegram bot settings.
module/platform/transport/http/admin/tool
Package tool holds the Hertz handlers of the admin tools: the system log tail, the version, IP geolocation and the server restart.
Package tool holds the Hertz handlers of the admin tools: the system log tail, the version, IP geolocation and the server restart.
module/platform/transport/http/common
Package common holds the Hertz handlers of the unauthenticated site-level reads: the global configuration, the terms of service and privacy policy, the site statistics, the client downloads and the heartbeat.
Package common holds the Hertz handlers of the unauthenticated site-level reads: the global configuration, the terms of service and privacy policy, the site statistics, the client downloads and the heartbeat.
module/platform/transport/http/internal/handlertest
Package handlertest drives the platform's Hertz handlers in their behaviour tests: it performs a request on a registered route and decodes the JSON envelope the handlers answer with, and it records the calls a fake facade port receives.
Package handlertest drives the platform's Hertz handlers in their behaviour tests: it performs a request on a registered route and decodes the JSON envelope the handlers answer with, and it records the calls a fake facade port receives.
module/subscription
Package subscription is the facade of the subscription module: plans and groups, the storefront, user subscriptions and their self-service, subscription delivery and client applications, order fulfillment and provider entitlements, trials, quota tasks, the lifecycle sweeps and calendar traffic resets, plan inventory and traffic usage accounting.
Package subscription is the facade of the subscription module: plans and groups, the storefront, user subscriptions and their self-service, subscription delivery and client applications, order fulfillment and provider entitlements, trials, quota tasks, the lifecycle sweeps and calendar traffic resets, plan inventory and traffic usage accounting.
module/subscription/contract
Package dto is the subscription module's contract: the commands, queries and results of its facade and HTTP handlers, and the module's own JSON snapshots of the identity and network data its views embed.
Package dto is the subscription module's contract: the commands, queries and results of its facade and HTTP handlers, and the module's own JSON snapshots of the identity and network data its views embed.
module/subscription/entity/client
Package client holds the subscription module's client-application entity (the subscribe_application table): the client apps subscriptions are delivered to, with their templates and download links.
Package client holds the subscription module's client-application entity (the subscribe_application table): the client apps subscriptions are delivered to, with their templates and download links.
module/subscription/entity/entitlement
Package entitlement stores provider-authoritative subscription periods.
Package entitlement stores provider-authoritative subscription periods.
module/subscription/entity/subscribe
Package subscribe holds the subscription module's plan entities: the plans (the subscribe table) and their groups (subscribe_group).
Package subscribe holds the subscription module's plan entities: the plans (the subscribe table) and their groups (subscribe_group).
module/subscription/entity/usersub
Package usersub holds the subscription domain's user-subscription entities (ADR-001 step 5: entity packages follow table ownership).
Package usersub holds the subscription domain's user-subscription entities (ADR-001 step 5: entity packages follow table ownership).
module/subscription/internal/application
Package application implements the client-application subdomain of the subscription module: managing the subscribe clients and previewing their delivery templates.
Package application implements the client-application subdomain of the subscription module: managing the subscribe clients and previewing their delivery templates.
module/subscription/internal/deduction
Package deduction provides functionality for calculating remaining amounts in subscription billing systems, supporting various time units and traffic-based calculations.
Package deduction provides functionality for calculating remaining amounts in subscription billing systems, supporting various time units and traffic-based calculations.
module/subscription/internal/delivery
Package delivery implements the subscription delivery subdomain of the subscription module: token-authenticated rendering of client configs via the adapter, with notice placeholders for expired/exhausted subscriptions.
Package delivery implements the subscription delivery subdomain of the subscription module: token-authenticated rendering of client configs via the adapter, with notice placeholders for expired/exhausted subscriptions.
module/subscription/internal/fulfillment
Package fulfillment applies a paid order's business effect: creating, renewing or traffic-resetting the user subscription in the fulfillment transaction, idempotent via the inbox marker.
Package fulfillment applies a paid order's business effect: creating, renewing or traffic-resetting the user subscription in the fulfillment transaction, idempotent via the inbox marker.
module/subscription/internal/inventory
Package inventory reserves and restores plan stock for orders, each at most once per order through inbox markers.
Package inventory reserves and restores plan stock for orders, each at most once per order through inbox markers.
module/subscription/internal/nodeaccess
Package nodeaccess serves the subscription side of node access to the other modules (ADR-001 rule 4): the subscriptions the network may serve, found by token, id or node scope together with their plans, and the cache invalidation when an account's access ends.
Package nodeaccess serves the subscription side of node access to the other modules (ADR-001 rule 4): the subscriptions the network may serve, found by token, id or node scope together with their plans, and the cache invalidation when an account's access ends.
module/subscription/internal/period
Package period holds the subscription module's calendar rules: the time units that size a subscription term and the traffic reset cycles of a plan.
Package period holds the subscription module's calendar rules: the time units that size a subscription term and the traffic reset cycles of a plan.
module/subscription/internal/plan
Package plan implements the subscription plan management subdomain of the subscription module: plan and group CRUD, ordering and token resets.
Package plan implements the subscription plan management subdomain of the subscription module: plan and group CRUD, ordering and token resets.
module/subscription/internal/quotatask
Package quotatask processes the admin-scheduled quota grants: extending subscription time and crediting gift money for a scope of subscriptions.
Package quotatask processes the admin-scheduled quota grants: extending subscription time and crediting gift money for a scope of subscriptions.
module/subscription/internal/render
Package render builds the client configurations of subscription delivery and template previews: it maps nodes to the proxies a client template renders and executes the template in the application's output format.
Package render builds the client configurations of subscription delivery and template previews: it maps nodes to the proxies a client template renders and executes the template in the application's output format.
module/subscription/internal/repo
Package repo holds the subscription module's repository implementations: plans and groups, user subscriptions with their traffic accounting and cache bridges, client applications and provider entitlements (ADR-001 step-6 preparation).
Package repo holds the subscription module's repository implementations: plans and groups, user subscriptions with their traffic accounting and cache bridges, client applications and provider entitlements (ADR-001 step-6 preparation).
module/subscription/internal/selfsub
Package selfsub implements the user self-service subscription management of the subscription module: viewing, token reset, notes, and the two-phase cancellation whose refund stage the billing module settles.
Package selfsub implements the user self-service subscription management of the subscription module: viewing, token reset, notes, and the two-phase cancellation whose refund stage the billing module settles.
module/subscription/internal/storefront
Package storefront implements the public subscription listings of the subscription module.
Package storefront implements the public subscription listings of the subscription module.
module/subscription/internal/subtest
Package subtest is the subscription module's behaviour-test fixture: a SQLite database with the module's tables and a miniredis cache behind the module's real repositories.
Package subtest is the subscription module's behaviour-test fixture: a SQLite database with the module's tables and a miniredis cache behind the module's real repositories.
module/subscription/internal/sweep
Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation).
Package sweep implements the subscription lifecycle sweep: marking traffic-exceeded and expired subscriptions finished, then firing the retryable side effects (owner notification, cache invalidation).
module/subscription/internal/trafficreset
Package trafficreset applies the plans' calendar traffic resets: on the 1st of every month, monthly on the start day and yearly on the start date (the rules live in period).
Package trafficreset applies the plans' calendar traffic resets: on the 1st of every month, monthly on the start day and yearly on the start date (the rules live in period).
module/subscription/internal/trafficusage
Package trafficusage owns idempotent subscription usage accounting.
Package trafficusage owns idempotent subscription usage accounting.
module/subscription/internal/trial
Package trial grants the registration trial subscription.
Package trial grants the registration trial subscription.
module/subscription/internal/usersub
Package usersub implements the admin-side user subscription management of the subscription module.
Package usersub implements the admin-side user subscription management of the subscription module.
module/subscription/transport/http
Package handler serves subscription delivery over HTTP: the client configuration for a subscription token or a pan-domain host.
Package handler serves subscription delivery over HTTP: the client configuration for a subscription token or a pan-domain host.
module/subscription/transport/http/admin/application
Package application holds the admin HTTP handlers for the client applications of subscription delivery and their template previews.
Package application holds the admin HTTP handlers for the client applications of subscription delivery and their template previews.
module/subscription/transport/http/admin/subscribe
Package subscribe holds the admin HTTP handlers for plans and plan groups.
Package subscribe holds the admin HTTP handlers for plans and plan groups.
module/subscription/transport/http/admin/user
Package user holds the admin HTTP handlers for the users' subscriptions.
Package user holds the admin HTTP handlers for the users' subscriptions.
module/subscription/transport/http/public/subscribe
Package subscribe holds the public HTTP handlers for the plan storefront and the owner's subscription nodes.
Package subscribe holds the public HTTP handlers for the plan storefront and the owner's subscription nodes.
module/subscription/transport/http/public/user
Package user holds the HTTP handlers through which users manage their own subscriptions.
Package user holds the HTTP handlers through which users manage their own subscriptions.
module/support
Package support is the facade of the support module: tickets, announcements, documents, ads and marketing tasks.
Package support is the facade of the support module: tickets, announcements, documents, ads and marketing tasks.
module/support/contract
Package dto holds the support module's contract: the requests and responses of the ticket, announcement, document, ads and marketing endpoints.
Package dto holds the support module's contract: the requests and responses of the ticket, announcement, document, ads and marketing endpoints.
module/support/entity/ads
Package ads holds the ads row (the ads table): an ad the public site shows while it is enabled and inside its schedule.
Package ads holds the ads row (the ads table): an ad the public site shows while it is enabled and inside its schedule.
module/support/entity/announcement
Package announcement holds the announcement row (the announcement table) and its list filter.
Package announcement holds the announcement row (the announcement table) and its list filter.
module/support/entity/document
Package document holds the help document row (the document table).
Package document holds the help document row (the document table).
module/support/entity/ticket
Package ticket holds the support ticket rows (the ticket and ticket_follow tables), the ticket statuses and the follow types.
Package ticket holds the support ticket rows (the ticket and ticket_follow tables), the ticket statuses and the follow types.
module/support/internal/ads
Package ads implements the ads subdomain of the support module.
Package ads implements the ads subdomain of the support module.
module/support/internal/announcement
Package announcement implements the announcement subdomain of the support module.
Package announcement implements the announcement subdomain of the support module.
module/support/internal/document
Package document implements the document subdomain of the support module.
Package document implements the document subdomain of the support module.
module/support/internal/marketing
Package marketing implements the marketing subdomain of the support module (batch email campaigns and quota gift tasks).
Package marketing implements the marketing subdomain of the support module (batch email campaigns and quota gift tasks).
module/support/internal/repo
Package repo holds the support module's repository implementations: tickets, announcements, ads and documents, each cached in Redis.
Package repo holds the support module's repository implementations: tickets, announcements, ads and documents, each cached in Redis.
module/support/internal/supporttest
Package supporttest is the support module's behaviour-test harness: the module's real repositories (tickets, announcements, ads and documents) and the platform's task bookkeeping the marketing tasks write, over a private in-memory SQLite database with miniredis as their cache, together with recording fakes of the module's ports onto the other domains, seeding and reading helpers, a way to make the database refuse statements, the API views of stored rows and a client for the Hertz handlers.
Package supporttest is the support module's behaviour-test harness: the module's real repositories (tickets, announcements, ads and documents) and the platform's task bookkeeping the marketing tasks write, over a private in-memory SQLite database with miniredis as their cache, together with recording fakes of the module's ports onto the other domains, seeding and reading helpers, a way to make the database refuse statements, the API views of stored rows and a client for the Hertz handlers.
module/support/internal/ticket
Package ticket implements the ticket subdomain of the support module.
Package ticket implements the ticket subdomain of the support module.
module/support/transport/http/admin/ads
Package ads holds the Hertz handlers of the admin ads management.
Package ads holds the Hertz handlers of the admin ads management.
module/support/transport/http/admin/announcement
Package announcement holds the Hertz handlers of the admin announcement management.
Package announcement holds the Hertz handlers of the admin announcement management.
module/support/transport/http/admin/document
Package document holds the Hertz handlers of the admin help document management.
Package document holds the Hertz handlers of the admin help document management.
module/support/transport/http/admin/marketing
Package marketing holds the Hertz handlers of the admin marketing tasks: batch email campaigns and quota gifts.
Package marketing holds the Hertz handlers of the admin marketing tasks: batch email campaigns and quota gifts.
module/support/transport/http/admin/ticket
Package ticket holds the Hertz handlers of the admin ticket desk.
Package ticket holds the Hertz handlers of the admin ticket desk.
module/support/transport/http/common
Package common holds the Hertz handler of the ads the public site shows.
Package common holds the Hertz handler of the ads the public site shows.
module/support/transport/http/public/announcement
Package announcement holds the Hertz handler of the announcements users see.
Package announcement holds the Hertz handler of the announcements users see.
module/support/transport/http/public/document
Package document holds the Hertz handlers of the help documents users read.
Package document holds the Hertz handlers of the help documents users read.
module/support/transport/http/public/ticket
Package ticket holds the Hertz handlers of a user's own tickets: opening, following up, reading and closing them.
Package ticket holds the Hertz handlers of a user's own tickets: opening, following up, reading and closing them.
repository
Package repository holds the modules' persistence contracts and the store assembled from them: the repository interfaces, the per-domain store views and scoped transactions, and GormStore, which builds every module's repositories over one shared connection pool with the builders the modules export.
Package repository holds the modules' persistence contracts and the store assembled from them: the repository interfaces, the per-domain store views and scoped transactions, and GormStore, which builds every module's repositories over one shared connection pool with the builders the modules export.
repository/kernel
Package kernel holds the persistence contracts of the shared kernel: the platform-owned repositories every module may use (system settings, the audit log, task bookkeeping and the event inbox and outbox), the platform transaction view and the pagination helpers.
Package kernel holds the persistence contracts of the shared kernel: the platform-owned repositories every module may use (system settings, the audit log, task bookkeeping and the event inbox and outbox), the platform transaction view and the pagination helpers.
transport/devicesocket
Package devicesocket keeps the WebSocket connections of signed-in client devices.
Package devicesocket keeps the WebSocket connections of signed-in client devices.
transport/http/middleware
Package middleware holds the Hertz middleware of the HTTP API: tracing, request logging and request metadata, CORS, session authentication and the administrator guard, the device transport envelope and the payment callback lookup.
Package middleware holds the Hertz middleware of the HTTP API: tracing, request logging and request metadata, CORS, session authentication and the administrator guard, the device transport envelope and the payment callback lookup.
transport/http/routes
Package routes is the URL table of the HTTP API: it registers every route with its middleware and hands each handler its module's facade.
Package routes is the URL table of the HTTP API: it registers every route with its middleware and hands each handler its module's facade.
transport/http/server
Package httpserver builds the Hertz server of the HTTP API: the middleware every request passes (tracing, request logging, CORS), the routes of package routes, and the Telegram webhook and payment notify handlers that their modules register.
Package httpserver builds the Hertz server of the HTTP API: the middleware every request passes (tracing, request logging, CORS), the routes of package routes, and the Telegram webhook and payment notify handlers that their modules register.
transport/http/setup
Package setup serves the first-installation wizard.
Package setup serves the first-installation wizard.
transport/http/validation
Package validation owns request-DTO validation independently from the application composition root.
Package validation owns request-DTO validation independently from the application composition root.
transport/task
Package task is the application's asynq consumer: it registers the handler of every task type and runs them behind the trace middleware, with one failure log line per attempt and the retry policy of the scheduled tasks.
Package task is the application's asynq consumer: it registers the handler of every task type and runs them behind the trace middleware, with one failure log line per attempt and the retry policy of the scheduled tasks.
transport/task/email
Package email holds the queue handlers that send email: single notifications (verification codes, expiry, traffic and maintenance notices, custom mail) and the marketing campaigns administrators run in batches, together with the workers that pace a campaign and record its progress.
Package email holds the queue handlers that send email: single notifications (verification codes, expiry, traffic and maintenance notices, custom mail) and the marketing campaigns administrators run in batches, together with the workers that pace a campaign and record its progress.
transport/task/events
Package events hosts the queue shells of the domain-event bus: the publish pump moving outbox rows onto the asynq broker, and the delivery worker running subscribers.
Package events hosts the queue shells of the domain-event bus: the publish pump moving outbox rows onto the asynq broker, and the delivery worker running subscribers.
transport/task/maintenance
Package maintenance holds the queue handlers of the maintenance tasks: the quota grants administrators schedule and the daily exchange-rate refresh.
Package maintenance holds the queue handlers of the maintenance tasks: the quota grants administrators schedule and the daily exchange-rate refresh.
transport/task/order
Package order holds the queue handlers of billing's order tasks: the activation of paid orders, the deferred close of unpaid ones, the paid and pending order reconcilers, the order-event outbox publication and retention, and the daily order report.
Package order holds the queue handlers of billing's order tasks: the activation of paid orders, the deferred close of unpaid ones, the paid and pending order reconcilers, the order-event outbox publication and retention, and the daily order report.
transport/task/sms
Package sms holds the queue handler that sends verification-code text messages through the configured provider and audits every attempt.
Package sms holds the queue handler that sends verification-code text messages through the configured provider and audits every attempt.
transport/task/subscription
Package subscription holds the queue handlers of the scheduled subscription tasks: the lifecycle sweep and the pre-expiry reminder.
Package subscription holds the queue handlers of the scheduled subscription tasks: the lifecycle sweep and the pre-expiry reminder.
transport/task/tasklock
Package tasklock keeps two runs of one periodic task from overlapping, across replicas, with a Redis lock that only its owner may release or extend.
Package tasklock keeps two runs of one periodic task from overlapping, across replicas, with a Redis lock that only its owner may release or extend.
transport/task/traffic
Package traffic holds the queue handlers of the traffic tasks: flushing the aggregated node traffic, the calendar traffic reset, the daily traffic statistics and the log retention.
Package traffic holds the queue handlers of the traffic tasks: flushing the aggregated node traffic, the calendar traffic reset, the daily traffic statistics and the log retention.
pkg
cache
Package cache is the read-through Redis cache of the GORM repositories.
Package cache is the read-through Redis cache of the GORM repositories.
conf
Package conf loads the YAML configuration file into a struct, first filling each field that has a `default` tag with that value, so a key the file leaves out keeps its documented default.
Package conf loads the YAML configuration file into a struct, first filling each field that has a `default` tag with that value, so a key the file leaves out keeps its documented default.
httpx
Package httpx holds the HTTP conventions the handlers share: binding a request's query, form and JSON values (ShouldBind), the response envelope and ETags.
Package httpx holds the HTTP conventions the handlers share: binding a request's query, form and JSON values (ShouldBind), the response envelope and ETags.
logger
Package logger is the process log.
Package logger is the process log.
logger/logtest
Package logtest redirects the process-wide logger output for the length of a test, so a test can assert what was logged or keep expected errors out of the test output.
Package logtest redirects the process-wide logger output for the length of a test, so a test can assert what was logged or keep expected errors out of the test output.
orm
Package orm opens the application's database, MySQL or PostgreSQL, from the database configuration, and holds the dialect-aware query helpers (CSV-column filters, escaped LIKE searches, date buckets, batched deletes) that repositories need to run the same queries on both drivers.
Package orm opens the application's database, MySQL or PostgreSQL, from the database configuration, and holds the dialect-aware query helpers (CSV-column filters, escaped LIKE searches, date buckets, batched deletes) that repositories need to run the same queries on both drivers.
random
Package random makes the random and derived strings the application hands out: verification codes, tokens and secrets from crypto/rand, and the invite-code encoding of user ids.
Package random makes the random and derived strings the application hands out: verification codes, tokens and secrets from crypto/rand, and the invite-code encoding of user ids.
requestmeta
Package requestmeta carries bounded HTTP request metadata across application layers and queue boundaries.
Package requestmeta carries bounded HTTP request metadata across application layers and queue boundaries.
slicesx
Package slicesx converts the lists the database stores as comma-separated strings, such as plan and node id lists, to and from slices, and deduplicates slices while keeping their order.
Package slicesx converts the lists the database stores as comma-separated strings, such as plan and node id lists, to and from slices, and deduplicates slices while keeping their order.
templatex
Package templatex renders the operator-configured text templates, such as the SMS message templates.
Package templatex renders the operator-configured text templates, such as the SMS message templates.
timeutil
Package timeutil provides centralized timezone handling for the application.
Package timeutil provides centralized timezone handling for the application.
trace
Package trace sets up OpenTelemetry tracing for the process.
Package trace sets up OpenTelemetry tracing for the process.
xerr
Package xerr is the error model of the API.
Package xerr is the error model of the API.
tools
mysql2postgres command

Jump to

Keyboard shortcuts

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