mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-07-03 00:51:22 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ae2a54da3 | ||
|
|
a36b6a13f4 | ||
|
|
7e1f4bbee3 |
@@ -10,7 +10,7 @@ S3 Balance 是一个用 Go 编写的 S3 兼容负载均衡器,可在多套对
|
||||
- **多桶调度**:支持轮询、剩余空间、加权和一致性哈希等策略,可热切换。
|
||||
- **健康监控**:周期性探活与容量统计,Prometheus 指标暴露在 `/metrics`。
|
||||
- **虚拟桶映射**:对外只暴露虚拟桶名称,真实桶在后端透明调度。
|
||||
- **代理或重定向模式**:可选择由服务转发数据,或返回预签名 URL 让客户端直连。
|
||||
- **代理或重定向模式**:可选择由服务转发数据,或返回302重定向让客户端直连。
|
||||
- **SigV4 认证**:配置 `s3api.auth_required` 后,通过 `github.com/DullJZ/s3-validate` 校验 AWS Signature Version 4 请求。
|
||||
|
||||
## 快速开始
|
||||
|
||||
@@ -8,7 +8,7 @@ S3 Balance is an S3-compatible load balancer written in Go. It automatically sel
|
||||
- **Multi-bucket Scheduling**: Supports strategies like round-robin, least-space, weighted, and consistent hashing, with hot-swapping capabilities.
|
||||
- **Health Monitoring**: Periodic health checks and capacity statistics, with Prometheus metrics exposed at `/metrics`.
|
||||
- **Virtual Bucket Mapping**: Only virtual bucket names are exposed externally, while real buckets are transparently scheduled in the backend.
|
||||
- **Proxy or Redirect Mode**: Choose between service-forwarded data or pre-signed URLs for direct client connections.
|
||||
- **Proxy or Redirect Mode**: Choose between service-forwarded data or 302 redirects for direct client connections.
|
||||
- **SigV4 Authentication**: When `s3api.auth_required` is enabled, AWS Signature Version 4 requests are validated using `github.com/DullJZ/s3-validate`.
|
||||
|
||||
## Quick Start
|
||||
|
||||
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/DullJZ/s3-balance
|
||||
go 1.24.5
|
||||
|
||||
require (
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251004111253-b3ec227d3796
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251103105435-c25eac6b580b
|
||||
github.com/aws/aws-sdk-go-v2 v1.39.2
|
||||
github.com/aws/aws-sdk-go-v2/config v1.31.1
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.18.5
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,7 +1,7 @@
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251004111253-b3ec227d3796 h1:0Lipgc3EHF2QOKpCziXApbVocdyzZ/3a52xluuWraXg=
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251004111253-b3ec227d3796/go.mod h1:OEx+/bRlDdI0oj/Bb1Plsq+1+qU1qal3/g9phixhU6Y=
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251103105435-c25eac6b580b h1:BHue7N77inSdaDUUZSO/gMmc3+4ZGdQA3ORdcLHnxtg=
|
||||
github.com/DullJZ/s3-validate v0.0.0-20251103105435-c25eac6b580b/go.mod h1:OEx+/bRlDdI0oj/Bb1Plsq+1+qU1qal3/g9phixhU6Y=
|
||||
github.com/aws/aws-sdk-go-v2 v1.39.2 h1:EJLg8IdbzgeD7xgvZ+I8M1e0fL0ptn/M47lianzth0I=
|
||||
github.com/aws/aws-sdk-go-v2 v1.39.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.0 h1:6GMWV6CNpA/6fbFHnoAjrv4+LGfyTqZz2LtCHnspgDg=
|
||||
|
||||
@@ -76,7 +76,7 @@ func (h *S3Handler) RegisterS3Routes(router *mux.Router) {
|
||||
|
||||
// 带认证/虚拟主机的路由
|
||||
protected := router.NewRoute().PathPrefix("/{bucket}").Subrouter()
|
||||
protected.StrictSlash(true)
|
||||
// 注意:不使用 StrictSlash(true) 以避免 301 重定向,兼容WinSCP
|
||||
|
||||
// Bucket operations
|
||||
protected.HandleFunc("", h.handleBucketOperations).Methods("GET", "HEAD", "PUT", "DELETE")
|
||||
|
||||
Reference in New Issue
Block a user