Add admin panel, manager, node_manager, bandwidth limiter, connection limiter, bonding, failover, vless encryption, mkcp transport

This commit is contained in:
Shtorm
2026-02-26 22:44:31 +03:00
parent 0f38dbba4c
commit ded1eb9635
115 changed files with 12582 additions and 301 deletions

View File

@@ -13,6 +13,8 @@ func init() {
}
type idKey struct{}
type muxIdKey struct{}
type hwidKey struct{}
type ID struct {
ID uint32
@@ -34,3 +36,28 @@ func IDFromContext(ctx context.Context) (ID, bool) {
id, loaded := ctx.Value((*idKey)(nil)).(ID)
return id, loaded
}
func ContextWithNewMuxID(ctx context.Context) context.Context {
return ContextWithMuxID(ctx, ID{
ID: rand.Uint32(),
CreatedAt: time.Now(),
})
}
func ContextWithMuxID(ctx context.Context, id ID) context.Context {
return context.WithValue(ctx, (*muxIdKey)(nil), id)
}
func MuxIDFromContext(ctx context.Context) (ID, bool) {
id, loaded := ctx.Value((*muxIdKey)(nil)).(ID)
return id, loaded
}
func ContextWithHWID(ctx context.Context, id ID) context.Context {
return context.WithValue(ctx, (*hwidKey)(nil), id)
}
func HWIDFromContext(ctx context.Context) (ID, bool) {
id, loaded := ctx.Value((*hwidKey)(nil)).(ID)
return id, loaded
}