Virtual docker/maven repos with per-repo upstreams (auth, http/socks5 proxy), client auth modes (public/password/users), TTL-based caching, localfs/S3 storage backends, web UI, and a multi-arch Dockerfile. Co-Authored-By: Claude Code <noreply@anthropic.com>
30 lines
467 B
Go
30 lines
467 B
Go
package ui
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func humanBytes(n int64) string {
|
|
const unit = 1024
|
|
if n < 0 {
|
|
return "—"
|
|
}
|
|
if n < unit {
|
|
return fmt.Sprintf("%d B", n)
|
|
}
|
|
div, exp := int64(unit), 0
|
|
for v := n / unit; v >= unit; v /= unit {
|
|
div *= unit
|
|
exp++
|
|
}
|
|
return fmt.Sprintf("%.1f %ciB", float64(n)/float64(div), "KMGTPE"[exp])
|
|
}
|
|
|
|
func formatTime(t time.Time) string {
|
|
if t.IsZero() {
|
|
return "—"
|
|
}
|
|
return t.Local().Format("2006-01-02 15:04:05")
|
|
}
|