GoWind 开源生态GoWind 开源生态
首页
框架
GoWind Admin
GoWind CMS
GoWind IM
GoWind UBA
GoWind IoT
GoWind Toolkit
GoWind Quant
GitHub
首页
框架
GoWind Admin
GoWind CMS
GoWind IM
GoWind UBA
GoWind IoT
GoWind Toolkit
GoWind Quant
GitHub
  • 介绍

    • GoWind 框架
    • 框架整体架构
  • go-wind 核心

    • go-wind 核心框架
    • App 生命周期管理
    • Context 传播
    • Transport 抽象
    • Log 门面接口
  • go-wind-plugins 插件

    • go-wind-plugins 插件总览
    • 插件配置系统
    • 插件注册机制(SPI)
    • 日志适配插件
    • 传输协议插件
    • 消息中间件插件
    • 编码解码插件
    • 安全与认证插件
    • 链路追踪插件
    • 缓存插件
    • 对象存储插件(OSS)
    • 限流插件
    • 指标监控插件
    • AI 插件
    • 工作流插件
    • 数据库与缓存插件
    • Bootstrap 集成与网关插件
    • 压缩与序列化插件
    • 模板渲染与验证插件
  • go-wind-bootstrap 启动器

    • go-wind-bootstrap 声明式启动器
    • Bootstrap 配置系统
    • Bootstrap SPI 机制
    • 声明式中间件编排
    • Bootstrap CLI 工具
    • Bootstrap 实战示例
  • 教程

    • 快速入门教程
    • 自定义插件开发教程
    • 多协议同时监听教程
    • 框架迁移指南

go-wind-plugins 插件总览

go-wind-plugins 是 GoWind 生态中最大的仓库,提供 100+ 个适配器插件,覆盖 8 大领域。所有插件遵循统一的接口契约,通过 SPI 机制自动注册。

一、插件分类

领域核心接口插件数量典型插件
Transporttransport.Server7+HTTP, gRPC, WebSocket, SSE
Loglog.Logger7+Zap, Zerolog, Logrus, Loki
Brokerbroker.Broker10+Kafka, RabbitMQ, NATS, Redis
Cachecache.Cache5+Redis, Memcached, FreeCache
Configconfig.Source6+File, Etcd, Consul, Nacos
Registryregistry.Registry5+Consul, Etcd, Nacos, ZooKeeper
Databaseent.Client8+MySQL, PostgreSQL, SQLite, MongoDB
Tracertracer.Tracer3+Jaeger, OTLP, Zipkin
OSSoss.OSS6+MinIO, S3, Aliyun OSS, Qiniu
Metricsmetrics.Metrics3+Prometheus, Datadog
Rate Limitratelimit.Limiter3+Token Bucket, Sentinel
Encodingencoding.Codec4+JSON, Protobuf, YAML, XML
AIai.Client5+OpenAI, Claude, Gemini, Ollama
Workflowworkflow.Engine2+Temporal, Celery
Securityauth.Authenticator4+JWT, OAuth2, Casbin

二、目录结构

go-wind-plugins/
├── transport/
│   ├── http/          # HTTP Server
│   ├── grpc/          # gRPC Server
│   ├── websocket/     # WebSocket Server
│   ├── sse/           # SSE Server
│   ├── tcp/           # TCP Server
│   ├── kcp/           # KCP Server
│   └── graphql/       # GraphQL Server
├── log/
│   ├── zap/           # Zap 适配器
│   ├── zerolog/       # Zerolog 适配器
│   ├── logrus/        # Logrus 适配器
│   ├── loki/          # Grafana Loki
│   ├── sentry/        # Sentry 错误追踪
│   ├── cloudwatch/    # AWS CloudWatch
│   └── aliyun_sls/    # 阿里云日志服务
├── broker/
│   ├── kafka/         # Apache Kafka
│   ├── rabbitmq/      # RabbitMQ
│   ├── nats/          # NATS
│   ├── redis/         # Redis Pub/Sub
│   ├── pulsar/        # Apache Pulsar
│   └── ...
├── cache/
│   ├── redis/         # Redis
│   ├── memcached/     # Memcached
│   └── freecache/     # FreeCache
├── config/
│   ├── file/          # 本地文件
│   ├── etcd/          # Etcd KV
│   ├── consul/        # Consul KV
│   ├── nacos/         # Nacos 配置中心
│   └── apollo/        # Apollo 配置中心
├── registry/
│   ├── consul/        # Consul 服务发现
│   ├── etcd/          # Etcd 服务发现
│   ├── nacos/         # Nacos 服务发现
│   └── zookeeper/     # ZooKeeper 服务发现
├── database/
│   ├── mysql/         # MySQL
│   ├── postgres/      # PostgreSQL
│   ├── sqlite/        # SQLite
│   ├── mongo/         # MongoDB
│   └── clickhouse/    # ClickHouse
├── tracer/
│   ├── jaeger/        # Jaeger
│   ├── otlp/          # OpenTelemetry
│   └── zipkin/        # Zipkin
├── oss/
│   ├── minio/         # MinIO
│   ├── s3/            # AWS S3
│   ├── aliyun/        # 阿里云 OSS
│   ├── qiniu/         # 七牛云
│   └── tencent/       # 腾讯云 COS
├── ai/
│   ├── openai/        # OpenAI
│   ├── claude/        # Anthropic Claude
│   ├── gemini/        # Google Gemini
│   ├── ollama/        # Ollama 本地模型
│   └── deepseek/      # DeepSeek
└── workflow/
    ├── temporal/       # Temporal 工作流
    └── celery/         # Celery 任务队列

三、插件约定

每个插件必须满足以下约定:

3.1 实现 SPI 接口

// transport/http/server.go
package http

type Server struct { ... }

func NewServer(opts ...Option) *Server { ... }

func (s *Server) Start(ctx context.Context) error { ... }
func (s *Server) Stop(ctx context.Context) error  { ... }
func (s *Server) Endpoint() []string              { ... }
func (s *Server) Type() string                    { return "http" }

3.2 函数式选项

type Option func(*Server)

func WithAddr(addr string) Option {
    return func(s *Server) { s.addr = addr }
}

func WithHandler(h http.Handler) Option {
    return func(s *Server) { s.handler = h }
}

func WithTLS(certFile, keyFile string) Option {
    return func(s *Server) {
        s.tls = true
        s.certFile = certFile
        s.keyFile = keyFile
    }
}

3.3 Bootstrap 注册

// transport/http/register.go
package http

import "github.com/tx7do/go-wind-bootstrap/registry"

func init() {
    registry.RegisterTransport("http", NewServer)
}

四、选择指南

场景推荐组合
Web API 服务HTTP + MySQL + Redis + Zap
微服务后端gRPC + PostgreSQL + Kafka + Jaeger
实时通信WebSocket + Redis + Zerolog
数据管道gRPC + ClickHouse + Kafka + Loki
AI 应用HTTP + PostgreSQL + OpenAI + Temporal
边缘/IoTTCP/KCP + SQLite + FreeCache

相关文档

  • 插件配置系统
  • 插件注册机制
  • 核心框架介绍
  • 框架整体架构
Edit this page
Last Updated:: 6/21/26, 9:28 PM
Contributors: Bobo
Next
插件配置系统