Files
telemt-api/internal/server/radar_test.go
T
Denozordec d021e4b1d7
Publish telemt-api gateway Docker image / test (push) Successful in 23s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 2m9s
Add Radar DC Telegram functionality and configuration
- Introduced new `RadarConfig` structure in `config.go` to manage radar settings, including `statuses_url`, `http_timeout_ms`, and `ping_from`.
- Implemented validation for radar configuration in `config_test.go` to ensure correct URL schemes and timeout limits.
- Added new API routes for radar statuses and ping functionality in the gateway, enhancing the service's capabilities.
- Updated documentation in `GATEWAY_RUN.md` to include details about the new radar features and their usage.
- Enhanced the user interface to include navigation and display options for the Radar DC section in the sidebar and page titles.
- Added client-side API functions for fetching radar statuses and ping responses, improving integration with the frontend.
2026-04-12 12:53:20 +07:00

20 lines
365 B
Go

package server
import "testing"
func TestHostOnly(t *testing.T) {
tests := []struct {
in, want string
}{
{"example.com:8080", "example.com"},
{"[::1]:443", "::1"},
{"127.0.0.1", "127.0.0.1"},
{"", ""},
}
for _, tt := range tests {
if got := hostOnly(tt.in); got != tt.want {
t.Errorf("hostOnly(%q) = %q, want %q", tt.in, got, tt.want)
}
}
}