yao/tai/registry/testing.go
Max 7373b0b6f7 feat(tai): enhance gRPC tunnel functionality and internal host handling
- Introduced ExpandHosts function to parse and expand comma-separated host entries, including special values like "internal" and "localhost".
- Updated gRPC server to utilize the new ExpandHosts function for improved host management.
- Added HostHasInternal function to check for "internal" in host strings, enhancing configuration flexibility.
- Implemented new gRPC endpoints for TaiTunnel registration and forwarding, improving tunnel communication capabilities.
- Refactored authentication logic to include new TaiTunnel endpoints, ensuring proper access control.

Made-with: Cursor
2026-03-12 20:35:17 +08:00

20 lines
417 B
Go

package registry
import (
"log/slog"
)
// NewForTest creates a standalone Registry for use in tests.
// Not intended for production use.
func NewForTest() *Registry {
return &Registry{
nodes: make(map[string]*TaiNode),
logger: slog.Default(),
}
}
// SetGlobalForTest replaces the global registry singleton for testing.
// Not intended for production use.
func SetGlobalForTest(r *Registry) {
global = r
}