init: 自 zomaintain/backend/rdplib 平移独立成库; module path 从上游 github.com/nakagami/grdp 改为 git.zeroonesoft.cn/golib/rdplib

This commit is contained in:
w11
2026-09-19 18:55:43 +08:00
commit 1096fbce9d
94 changed files with 36790 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
package core
import (
"encoding/hex"
"log/slog"
)
// Hex wraps a byte slice as a slog.LogValuer that lazily encodes the bytes
// as a hexadecimal string only when the slog handler actually formats it.
//
// Use Hex(buf) instead of hex.EncodeToString(buf) inside slog.Debug calls on
// hot paths: when the logger's level filter discards the record (the common
// case in production), the encode and the per-call string allocation are
// skipped entirely.
type Hex []byte
// LogValue implements slog.LogValuer.
func (h Hex) LogValue() slog.Value {
return slog.StringValue(hex.EncodeToString(h))
}