refactor: introduce constants for improved maintainability in tests and server configurations

- Added constants for test endpoints, usernames, and XML headers in client_test.go and device_certificates_test.go to enhance readability and reduce hardcoded values.
- Updated various test cases to utilize these constants, ensuring consistency across tests.
- Refactored imaging settings and server configurations to use defined constants for default values, improving clarity and maintainability in server/device.go and server/imaging.go.
- Enhanced comments throughout the code to clarify functionality and adhere to best practices.
This commit is contained in:
0x524a
2025-12-02 21:39:54 -05:00
parent 31df3f8b79
commit c1daba5be6
25 changed files with 253 additions and 159 deletions
+2 -3
View File
@@ -110,7 +110,7 @@ func discoverCameras() {
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout*time.Second)
defer cancel()
devices, err := discovery.DiscoverWithOptions(ctx, 5*time.Second, opts)
devices, err := discovery.DiscoverWithOptions(ctx, defaultRetryDelay*time.Second, opts)
if err != nil {
fmt.Printf("❌ Error: %v\n", err)
@@ -233,8 +233,7 @@ func connectAndShowInfo() {
}
}
//nolint:gocyclo // PTZ demo function has high complexity due to multiple control paths
func ptzDemo() {
func ptzDemo() { //nolint:funlen,gocyclo // Many statements and high complexity due to user interaction
reader := bufio.NewReader(os.Stdin)
fmt.Print("Camera IP: ")