sing-box/adapter/user_manager.go
Niko Marmeladkov a3404e463f
Some checks are pending
Build / Calculate version (push) Waiting to run
Build / Build binary (push) Blocked by required conditions
Build / Build Darwin binaries (push) Blocked by required conditions
Build / Build Windows binaries (push) Blocked by required conditions
Build / Build Android (push) Blocked by required conditions
Build / Publish Android (push) Blocked by required conditions
Build / Build Apple clients (push) Blocked by required conditions
Build / Upload builds (push) Blocked by required conditions
feat: add universal user_manager service for external auth & traffic tracking
- New UserManager service with HTTPS auth, credential sync, traffic tracking, and kick API
- Integrates into all 10 protocol inbounds (hysteria2, tuic, vless, vmess, trojan,
  shadowsocks, http, socks, mixed, naive)
- Each inbound auto-detects user_manager from service context, falls back to static config
- Auth server contract: POST /api/auth, GET /api/credentials, POST /api/traffic
2026-06-18 15:49:49 +03:00

23 lines
545 B
Go

package adapter
import "context"
type UserTraffic struct {
Tx int64 `json:"tx"`
Rx int64 `json:"rx"`
}
type UserInfo struct {
Username string
Credential string
}
type UserManager interface {
Service
Authenticate(ctx context.Context, protocol string, credential string, addr string) (username string, err error)
GetCredentials(protocol string) ([]UserInfo, error)
ReportTraffic(username string, tx int64, rx int64)
GetTraffic(username string) (tx int64, rx int64)
ListTraffic() map[string]UserTraffic
KickUser(username string)
}