lava

command module
v2.0.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

Lava

Lava 是一个面向 Go 微服务场景的中台集成框架,提供统一的服务抽象、调试能力、网关能力、隧道能力与开发工具链。

核心能力

  • 统一服务抽象:HTTP / gRPC / 定时任务 / Tunnel Gateway
  • 统一中间件模型:lava.Middleware 一套接口覆盖多组件
  • 可观测性内建:日志、指标、调试路由(/debug
  • 网关能力:pkg/gateway 提供 HTTP/JSON 到 gRPC 的转换
  • 本地开发工具:watchcurldevproxyfileserver
  • Protobuf 工程化:protobuf.yaml + task proto:*

快速开始

1) 环境要求
  • Go 1.25+
  • Task(推荐)
2) 获取源码
git clone https://github.com/pubgo/lava.git
cd lava
go mod tidy
3) 基础检查
task test
task lint
4) 构建并体验 CLI
go build -o lava .
./lava

当前入口命令(main.go

以仓库根入口 main.go 为准。

命令 说明
lava watch 文件变更监听并自动执行命令
lava curl 面向 Gateway 的 HTTP 调试客户端(支持 login
lava tunnel gateway 启动 Tunnel Gateway
lava fileserver <dir> 本地目录静态文件服务
lava devproxy 本地开发代理(DNS + HTTP 反向代理)

架构速览

flowchart TD
		U[开发者/调用方] --> CLI[lava CLI]
		U --> HTTP[HTTP Client]
		U --> GRPC[gRPC Client]

		CLI --> CMDS[cmds/*]
		HTTP --> SHTTP[servers/https]
		GRPC --> SGRPC[servers/grpcs]

		SHTTP --> CORE[core/*]
		SGRPC --> CORE
		CMDS --> CORE

		CORE --> GW[pkg/gateway]
		CORE --> DEBUG["/debug routes"]
		CORE --> OBS[logging/metrics/tracing]
		CORE --> TUNNEL[core/tunnel]

文档导航

  • 文档总览:docs/README.md
  • 架构文档(含流程图):docs/architecture-v2.md
  • 设计文档(含关键抽象):docs/design-v2.md
  • 命令文档:docs/lava-command.md
  • 模块总览:docs/modules/README.md
    • Core:docs/modules/core.md
    • Servers:docs/modules/servers.md
    • Clients:docs/modules/clients.md
    • Pkg:docs/modules/pkg.md
    • Cmds:docs/modules/cmds.md

Protobuf 流程

task proto:fmt
task proto:lint
task proto:gen

配置位于 protobuf.yaml,生成代码输出到 pkg/proto

许可证

本项目使用 LICENSE 中定义的开源许可证。

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
clients
resty/examples command
cmds
core
debug/featurehttp
Package featurehttp 提供 feature flags 的 HTTP 调试接口
Package featurehttp 提供 feature flags 的 HTTP 调试接口
registry
Package registry is an interface for service discovery
Package registry is an interface for service discovery
registry/drivers/mdns
Package mdns is a multicast dns registry
Package mdns is a multicast dns registry
tunnel
Package tunnel 提供服务代理网关功能
Package tunnel 提供服务代理网关功能
tunnel/example command
Package main provides a simple example of using the tunnel package.
Package main provides a simple example of using the tunnel package.
tunnel/tunnelagent
Package tunnelagent 提供隧道代理客户端实现
Package tunnelagent 提供隧道代理客户端实现
tunnel/tunneldebug
Package tunneldebug 提供 Tunnel Gateway 的 Web 管理界面
Package tunneldebug 提供 Tunnel Gateway 的 Web 管理界面
internal
examples/grpcweb command
Package main 提供 gRPC Web 示例服务
Package main 提供 gRPC Web 示例服务
examples/tunnel command
examples/xz command
pkg
wsproxy
Package wsproxy implements a websocket proxy for grpc-gateway backed services
Package wsproxy implements a websocket proxy for grpc-gateway backed services
servers

Jump to

Keyboard shortcuts

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