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:
@@ -94,6 +94,8 @@ func Discover(ctx context.Context, timeout time.Duration) ([]*Device, error) {
|
||||
}
|
||||
|
||||
// DiscoverWithOptions discovers ONVIF devices with custom options.
|
||||
//
|
||||
//nolint:gocyclo // Discovery function has high complexity due to multiple network operations
|
||||
func DiscoverWithOptions(ctx context.Context, timeout time.Duration, opts *DiscoverOptions) ([]*Device, error) {
|
||||
if opts == nil {
|
||||
opts = &DiscoverOptions{}
|
||||
@@ -236,7 +238,7 @@ func generateUUID() string {
|
||||
|
||||
// resolveNetworkInterface resolves a network interface by name or IP address.
|
||||
//
|
||||
//nolint:gocognit // Network interface resolution has high complexity due to multiple validation paths
|
||||
//nolint:gocyclo,gocognit // Network interface resolution has high complexity due to multiple validation paths
|
||||
func resolveNetworkInterface(ifaceSpec string) (*net.Interface, error) {
|
||||
// Try to get interface by name (e.g., "eth0", "wlan0")
|
||||
if iface, err := net.InterfaceByName(ifaceSpec); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user