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:
@@ -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: ")
|
||||
|
||||
Reference in New Issue
Block a user