{"id":37148854,"url":"https://github.com/0x524a/onvif-go","last_synced_at":"2026-01-14T17:34:59.676Z","repository":{"id":323593739,"uuid":"1086084962","full_name":"0x524a/onvif-go","owner":"0x524a","description":"Modern Go library for ONVIF IP camera integration - Control surveillance cameras with PTZ, streaming, imaging. Client \u0026 Server implementation. Works with Hikvision, Axis, Dahua, Bosch cameras or any ONVIF-compliant camera.","archived":false,"fork":false,"pushed_at":"2025-12-04T02:32:34.000Z","size":8430,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-04T21:59:31.091Z","etag":null,"topics":["camera","camera-control","camera-sdk","golang","golang-library","golang-server","ip-camera","onvif","ptz","rtsp","security-camera","soap","surveillance","video-management","video-streaming","ws-discovery"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/0x524A/onvif-go","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x524a.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-29T23:34:08.000Z","updated_at":"2025-12-03T06:06:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/0x524a/onvif-go","commit_stats":null,"previous_names":["0x524a/go-onvif","0x524a/onvif-go"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/0x524a/onvif-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x524a%2Fonvif-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x524a%2Fonvif-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x524a%2Fonvif-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x524a%2Fonvif-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x524a","download_url":"https://codeload.github.com/0x524a/onvif-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x524a%2Fonvif-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28428589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camera","camera-control","camera-sdk","golang","golang-library","golang-server","ip-camera","onvif","ptz","rtsp","security-camera","soap","surveillance","video-management","video-streaming","ws-discovery"],"created_at":"2026-01-14T17:34:58.938Z","updated_at":"2026-01-14T17:34:59.665Z","avatar_url":"https://github.com/0x524a.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# onvif-go - ONVIF Client and Server Library for Go\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/0x524a/onvif-go.svg)](https://pkg.go.dev/github.com/0x524a/onvif-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/0x524a/onvif-go)](https://goreportcard.com/report/github.com/0x524a/onvif-go)\n[![codecov](https://codecov.io/gh/0x524a/onvif-go/branch/master/graph/badge.svg)](https://codecov.io/gh/0x524a/onvif-go)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=0x524a_onvif-go\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=0x524a_onvif-go)\n[![License](https://img.shields.io/github/license/0x524a/onvif-go)](LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/0x524a/onvif-go)](https://github.com/0x524a/onvif-go/stargazers)\n[![GitHub issues](https://img.shields.io/github/issues/0x524a/onvif-go)](https://github.com/0x524a/onvif-go/issues)\n\n\u003e **Modern, high-performance Go library for ONVIF IP camera integration** - Control surveillance cameras, NVRs, and video devices with comprehensive ONVIF Profile S/T/G support. Includes both client and server implementations for complete ONVIF camera simulation and testing.\n\nA production-ready, feature-rich Go (Golang) library for communicating with ONVIF-compliant IP cameras, network video recorders (NVR), and surveillance devices. Perfect for building video management systems (VMS), security camera applications, IoT projects, and camera testing frameworks.\n\n## 🎯 Key Features at a Glance\n\n- ✅ **ONVIF Client \u0026 Server** - Both client library and virtual camera server\n- ✅ **Production Ready** - Battle-tested with multiple camera brands\n- ✅ **Full Protocol Support** - Device, Media, PTZ, Imaging, Discovery services\n- ✅ **Type Safe** - Comprehensive Go types for all ONVIF operations\n- ✅ **Well Documented** - Extensive examples and API documentation\n- ✅ **Camera Tested** - Verified with Hikvision, Axis, Dahua, Bosch cameras\n- ✅ **Testing Framework** - Built-in mock server and testing utilities\n\n## 🔑 What is ONVIF?\n\nONVIF (Open Network Video Interface Forum) is an open industry standard for IP-based security products. This library allows you to:\n\n- 🎥 Control IP cameras from any manufacturer (Bosch, Hikvision, Axis, Dahua, etc.)\n- 📹 Get RTSP video streams and snapshots\n- 🎮 Pan, tilt, and zoom cameras remotely\n- 🔧 Configure camera settings (exposure, focus, white balance)\n- 🔍 Discover cameras on your network automatically\n- 🧪 Test ONVIF implementations without physical hardware\n\n## Features\n\n### 📡 ONVIF Client\n\n✨ **Modern Go Design**\n- Context support for cancellation and timeouts\n- Concurrent-safe operations\n- Type-safe API with comprehensive error handling\n- Connection pooling for optimal performance\n\n🎥 **Comprehensive ONVIF Support**\n- **Device Management**: Get device info, capabilities, system date/time, reboot\n- **Media Services**: Profiles, stream URIs (RTSP/HTTP), snapshot URIs, encoder configuration\n- **PTZ Control**: Continuous, absolute, and relative movement, presets, status\n- **Imaging**: Get/set brightness, contrast, exposure, focus, white balance, WDR\n- **Discovery**: Automatic camera detection via WS-Discovery multicast\n\n### 🎬 ONVIF Server (NEW!)\n\n🎥 **Virtual IP Camera Simulator**\n- **Multi-Lens Camera Support**: Simulate up to 10 independent camera profiles\n- **Complete ONVIF Implementation**: Device, Media, PTZ, and Imaging services\n- **Flexible Configuration**: CLI and library interfaces for easy setup\n- **PTZ Simulation**: Full pan-tilt-zoom control with preset positions\n- **Imaging Control**: Brightness, contrast, exposure, focus, and more\n- **Testing \u0026 Development**: Perfect for testing ONVIF clients without physical cameras\n\n🔐 **Security**\n- WS-Security with UsernameToken authentication\n- Password digest (SHA-1) support\n- Configurable timeout and HTTP client options\n\n📦 **Easy Integration**\n- Simple, intuitive API\n- Well-documented with examples\n- No external dependencies beyond Go standard library and golang.org/x/net\n\n## Installation\n\n```bash\ngo get github.com/0x524a/onvif-go\n```\n\n## Quick Start\n\n### Discover Cameras on Network\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n    \"time\"\n\n    \"github.com/0x524a/onvif-go/discovery\"\n)\n\nfunc main() {\n    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n    defer cancel()\n\n    devices, err := discovery.Discover(ctx, 5*time.Second)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    for _, device := range devices {\n        fmt.Printf(\"Found: %s at %s\\n\", \n            device.GetName(), \n            device.GetDeviceEndpoint())\n    }\n}\n```\n\n### Connect to a Camera\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"log\"\n    \"time\"\n\n    \"github.com/0x524a/onvif-go\"\n)\n\nfunc main() {\n    // Create client - endpoint can be:\n    //   - Full URL: \"http://192.168.1.100/onvif/device_service\"\n    //   - IP with port: \"192.168.1.100:8080\"\n    //   - IP only: \"192.168.1.100\" (automatically adds http:// and path)\n    client, err := onvif.NewClient(\n        \"192.168.1.100\",  // Simple IP address\n        onvif.WithCredentials(\"admin\", \"password\"),\n        onvif.WithTimeout(30*time.Second),\n    )\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    ctx := context.Background()\n\n    // Get device information\n    info, err := client.GetDeviceInformation(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    fmt.Printf(\"Camera: %s %s\\n\", info.Manufacturer, info.Model)\n    fmt.Printf(\"Firmware: %s\\n\", info.FirmwareVersion)\n\n    // Initialize and discover service endpoints\n    if err := client.Initialize(ctx); err != nil {\n        log.Fatal(err)\n    }\n\n    // Get media profiles\n    profiles, err := client.GetProfiles(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Get stream URI\n    if len(profiles) \u003e 0 {\n        streamURI, err := client.GetStreamURI(ctx, profiles[0].Token)\n        if err != nil {\n            log.Fatal(err)\n        }\n        fmt.Printf(\"Stream URI: %s\\n\", streamURI.URI)\n    }\n}\n```\n\n### PTZ Control\n\n```go\n// Continuous movement\nvelocity := \u0026onvif.PTZSpeed{\n    PanTilt: \u0026onvif.Vector2D{X: 0.5, Y: 0.0}, // Move right\n}\ntimeout := \"PT2S\" // 2 seconds\nerr := client.ContinuousMove(ctx, profileToken, velocity, \u0026timeout)\n\n// Stop movement\nerr = client.Stop(ctx, profileToken, true, true)\n\n// Absolute positioning\nposition := \u0026onvif.PTZVector{\n    PanTilt: \u0026onvif.Vector2D{X: 0.0, Y: 0.0}, // Center\n    Zoom:    \u0026onvif.Vector1D{X: 0.5},         // 50% zoom\n}\nerr = client.AbsoluteMove(ctx, profileToken, position, nil)\n\n// Go to preset\npresets, err := client.GetPresets(ctx, profileToken)\nif len(presets) \u003e 0 {\n    err = client.GotoPreset(ctx, profileToken, presets[0].Token, nil)\n}\n```\n\n### Imaging Settings\n\n```go\n// Get current settings\nsettings, err := client.GetImagingSettings(ctx, videoSourceToken)\n\n// Modify settings\nbrightness := 60.0\nsettings.Brightness = \u0026brightness\n\ncontrast := 55.0\nsettings.Contrast = \u0026contrast\n\n// Apply settings\nerr = client.SetImagingSettings(ctx, videoSourceToken, settings, true)\n```\n\n## API Overview\n\n### API Coverage Summary\n\nThe onvif-go library provides comprehensive ONVIF protocol support with **200+ implemented APIs** across all major ONVIF services:\n\n- **Device Management**: 98 APIs (100% complete) ✅\n- **Media Service**: 14+ APIs (profiles, streams, encoding) ✅\n- **PTZ Service**: 13 APIs (movement, presets, status) ✅\n- **Imaging Service**: 7 APIs (brightness, contrast, focus control) ✅\n- **Discovery Service**: WS-Discovery network scanning ✅\n\n### Client Creation\n\n```go\nclient, err := onvif.NewClient(\n    endpoint,\n    onvif.WithCredentials(username, password),\n    onvif.WithTimeout(30*time.Second),\n    onvif.WithHTTPClient(customHTTPClient),\n)\n```\n\n### Device Service (98 APIs) - 100% Complete ✅\n\nThe Device Service provides comprehensive device management capabilities with **98 fully implemented APIs**:\n\n#### Core Device Information\n| Method | Description |\n|--------|-------------|\n| `GetDeviceInformation()` | Get manufacturer, model, firmware version, serial number, hardware ID |\n| `GetCapabilities()` | Get device capabilities and service endpoints (device, media, imaging, PTZ, events, etc.) |\n| `GetServices()` | Get list of services with optional capabilities |\n| `GetServiceCapabilities()` | Get device service-specific capabilities |\n| `GetEndpointReference()` | Get device's WS-Addressing endpoint reference |\n| `SystemReboot()` | Reboot the device |\n| `Initialize()` | Discover and cache service endpoints |\n\n#### Hostname \u0026 Network Discovery\n| Method | Description |\n|--------|-------------|\n| `GetHostname()` | Get device hostname configuration |\n| `SetHostname()` | Set device hostname |\n| `SetHostnameFromDHCP()` | Enable/disable hostname from DHCP |\n| `GetScopes()` | Get configured WS-Discovery scopes |\n| `SetScopes()` | Set WS-Discovery scopes |\n| `AddScopes()` | Add WS-Discovery scopes |\n| `RemoveScopes()` | Remove WS-Discovery scopes |\n\n#### DNS Configuration\n| Method | Description |\n|--------|-------------|\n| `GetDNS()` | Get DNS configuration (DHCP and manual DNS servers) |\n| `SetDNS()` | Set DNS configuration (from DHCP, search domains, DNS servers) |\n\n#### NTP Configuration\n| Method | Description |\n|--------|-------------|\n| `GetNTP()` | Get NTP configuration (DHCP and manual NTP servers) |\n| `SetNTP()` | Set NTP configuration (from DHCP, NTP servers) |\n\n#### Dynamic DNS\n| Method | Description |\n|--------|-------------|\n| `GetDynamicDNS()` | Get Dynamic DNS configuration |\n| `SetDynamicDNS()` | Set Dynamic DNS with type and name |\n\n#### System Date \u0026 Time\n| Method | Description |\n|--------|-------------|\n| `GetSystemDateAndTime()` | Get device system date and time (interface{}) |\n| `FixedGetSystemDateAndTime()` | Get properly typed system date and time with timezone support |\n| `SetSystemDateAndTime()` | Set device system date and time with manual/NTP mode |\n\n#### Network Configuration\n| Method | Description |\n|--------|-------------|\n| `GetNetworkInterfaces()` | Get all network interface configurations |\n| `GetNetworkProtocols()` | Get network protocol settings (HTTP, HTTPS, RTSP, RTMP, SSH, etc.) |\n| `SetNetworkProtocols()` | Set network protocol settings |\n| `GetNetworkDefaultGateway()` | Get default gateway configuration (IPv4 and IPv6) |\n| `SetNetworkDefaultGateway()` | Set default gateway configuration |\n| `GetZeroConfiguration()` | Get Zero Configuration (zeroconf/Bonjour) status |\n| `SetZeroConfiguration()` | Enable/disable Zero Configuration per interface |\n\n#### User Management\n| Method | Description |\n|--------|-------------|\n| `GetUsers()` | Get list of user accounts and credentials |\n| `CreateUsers()` | Create new user accounts |\n| `SetUser()` | Modify existing user account |\n| `DeleteUsers()` | Delete user accounts |\n| `GetRemoteUser()` | Get remote user connection status |\n| `SetRemoteUser()` | Set remote user connection settings |\n\n#### Security \u0026 Access Control\n| Method | Description |\n|--------|-------------|\n| `GetIPAddressFilter()` | Get IP address filter (allow/deny lists) |\n| `SetIPAddressFilter()` | Set IP address filtering rules |\n| `AddIPAddressFilter()` | Add IP addresses to filter list |\n| `RemoveIPAddressFilter()` | Remove IP addresses from filter list |\n| `GetPasswordComplexityConfiguration()` | Get password policy settings |\n| `SetPasswordComplexityConfiguration()` | Set password policy (length, uppercase, numbers, special chars) |\n| `GetPasswordHistoryConfiguration()` | Get password history requirements |\n| `SetPasswordHistoryConfiguration()` | Set password history and re-use prevention |\n| `GetAuthFailureWarningConfiguration()` | Get failed authentication warning settings |\n| `SetAuthFailureWarningConfiguration()` | Set failed authentication thresholds |\n\n#### Discovery Modes\n| Method | Description |\n|--------|-------------|\n| `GetDiscoveryMode()` | Get discovery mode (Discoverable/NonDiscoverable) |\n| `SetDiscoveryMode()` | Set discovery mode |\n| `GetRemoteDiscoveryMode()` | Get remote discovery mode |\n| `SetRemoteDiscoveryMode()` | Set remote discovery mode |\n\n#### Certificate Management\n| Method | Description |\n|--------|-------------|\n| `GetCertificates()` | Get installed certificates |\n| `GetCACertificates()` | Get Certificate Authority certificates |\n| `LoadCertificates()` | Load/install certificates |\n| `LoadCACertificates()` | Load/install CA certificates |\n| `CreateCertificate()` | Create self-signed certificate |\n| `DeleteCertificates()` | Delete certificates |\n| `GetCertificateInformation()` | Get certificate details and validity |\n| `GetCertificatesStatus()` | Get certificate usage status |\n| `SetCertificatesStatus()` | Set certificate usage (enabled/disabled) |\n| `GetPkcs10Request()` | Generate PKCS#10 certificate signing request |\n| `LoadCertificateWithPrivateKey()` | Load certificate with private key |\n| `GetClientCertificateMode()` | Check if client certificate authentication enabled |\n| `SetClientCertificateMode()` | Enable/disable client certificate authentication |\n\n#### WiFi/802.11 Configuration\n| Method | Description |\n|--------|-------------|\n| `GetDot11Capabilities()` | Get WiFi capabilities (cipher suites, auth modes) |\n| `GetDot11Status()` | Get WiFi status (SSID, signal strength, link quality) |\n| `GetDot1XConfiguration()` | Get 802.1X EAP configuration |\n| `GetDot1XConfigurations()` | Get all 802.1X configurations |\n| `SetDot1XConfiguration()` | Set 802.1X configuration |\n| `CreateDot1XConfiguration()` | Create new 802.1X configuration |\n| `DeleteDot1XConfiguration()` | Delete 802.1X configuration |\n| `ScanAvailableDot11Networks()` | Scan for available WiFi networks |\n\n#### Storage Configuration\n| Method | Description |\n|--------|-------------|\n| `GetStorageConfigurations()` | Get all storage configurations |\n| `GetStorageConfiguration()` | Get specific storage configuration |\n| `CreateStorageConfiguration()` | Create new storage configuration |\n| `SetStorageConfiguration()` | Update storage configuration |\n| `DeleteStorageConfiguration()` | Delete storage configuration |\n| `SetHashingAlgorithm()` | Set password hashing algorithm |\n\n#### System Maintenance \u0026 Logs\n| Method | Description |\n|--------|-------------|\n| `GetSystemLog()` | Get system logs (boot, security, etc.) |\n| `GetSystemBackup()` | Get available system backups |\n| `RestoreSystem()` | Restore from backup file |\n| `GetSystemUris()` | Get system log and backup URIs |\n| `GetSystemSupportInformation()` | Get support information and system details |\n| `SetSystemFactoryDefault()` | Reset device to factory defaults |\n| `StartFirmwareUpgrade()` | Initiate firmware upgrade |\n| `StartSystemRestore()` | Initiate system restore |\n\n#### Relay \u0026 Auxiliary I/O\n| Method | Description |\n|--------|-------------|\n| `GetRelayOutputs()` | Get relay outputs and their current state |\n| `SetRelayOutputSettings()` | Configure relay output behavior |\n| `SetRelayOutputState()` | Set relay output state (active/inactive) |\n| `SendAuxiliaryCommand()` | Send auxiliary commands (e.g., IR control) |\n\n#### Additional Features\n| Method | Description |\n|--------|-------------|\n| `GetGeoLocation()` | Get device geographic location |\n| `SetGeoLocation()` | Set device geographic location |\n| `DeleteGeoLocation()` | Delete geographic location |\n| `GetDPAddresses()` | Get WS-Discovery multicast addresses |\n| `SetDPAddresses()` | Set WS-Discovery multicast addresses |\n| `GetAccessPolicy()` | Get device access policy |\n| `SetAccessPolicy()` | Set device access policy |\n| `GetWsdlUrl()` | Get device WSDL URL (deprecated) |\n\n## 🔧 Device Management Features\n\nThe onvif-go library provides **98 fully-implemented Device Management APIs** for complete device configuration and control. See [DEVICE_API_STATUS.md](DEVICE_API_STATUS.md) for the complete API reference.\n\n### Common Device Management Use Cases\n\n#### Query Device Information\n```go\n// Get device info (manufacturer, model, firmware)\ninfo, err := client.GetDeviceInformation(ctx)\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Printf(\"Camera: %s %s (FW: %s)\\n\", info.Manufacturer, info.Model, info.FirmwareVersion)\n\n// Get capabilities\ncaps, err := client.GetCapabilities(ctx)\nif err != nil {\n    log.Fatal(err)\n}\n```\n\n#### Network Configuration\n```go\n// Get all network interfaces\ninterfaces, err := client.GetNetworkInterfaces(ctx)\nif err != nil {\n    log.Fatal(err)\n}\n\n// Get DNS and NTP settings\ndns, err := client.GetDNS(ctx)\nntp, err := client.GetNTP(ctx)\n\n// Configure DNS\nerr = client.SetDNS(ctx, false, []string{\"example.com\"}, []onvif.IPAddress{\n    {Type: \"IPv4\", IPv4Address: \"8.8.8.8\"},\n})\n\n// Get/Set hostname\nhostname, err := client.GetHostname(ctx)\nerr = client.SetHostname(ctx, \"new-camera-name\")\n```\n\n#### User \u0026 Security Management\n```go\n// Get users\nusers, err := client.GetUsers(ctx)\n\n// Create new user\nerr = client.CreateUsers(ctx, []*onvif.User{\n    {Username: \"operator\", Password: \"pass123\"},\n})\n\n// Configure security\nerr = client.SetPasswordComplexityConfiguration(ctx, \u0026onvif.PasswordComplexityConfiguration{\n    MinLen:        8,\n    Uppercase:     1,\n    Number:        1,\n    SpecialChars:  1,\n})\n\n// IP address filtering\nfilter := \u0026onvif.IPAddressFilter{\n    Type: onvif.IPAddressFilterAllow,\n}\nerr = client.SetIPAddressFilter(ctx, filter)\n```\n\n#### Certificate Management\n```go\n// Get installed certificates\ncerts, err := client.GetCertificates(ctx)\n\n// Create self-signed certificate\ncert, err := client.CreateCertificate(ctx,\n    \"cert1\",\n    \"CN=camera.example.com\",\n    \"2024-01-01T00:00:00Z\",\n    \"2025-01-01T00:00:00Z\",\n)\n\n// Check certificate status\nstatus, err := client.GetCertificatesStatus(ctx)\n\n// Enable client certificate authentication\nerr = client.SetClientCertificateMode(ctx, true)\n```\n\n#### System Maintenance\n```go\n// Get system logs\nlog, err := client.GetSystemLog(ctx, onvif.SystemLogTypeBoot)\n\n// Get system backup\nbackups, err := client.GetSystemBackup(ctx)\n\n// Reboot device\nrebootToken, err := client.SystemReboot(ctx)\n\n// Set factory defaults\nerr = client.SetSystemFactoryDefault(ctx, onvif.FactoryDefaultTypeSoft)\n\n// Firmware upgrade\nupgradeToken, err := client.StartFirmwareUpgrade(ctx)\n```\n\n#### WiFi Configuration (802.11/802.1X)\n```go\n// Get WiFi capabilities\ncaps, err := client.GetDot11Capabilities(ctx)\n\n// Scan available networks\nnetworks, err := client.ScanAvailableDot11Networks(ctx, \"interface1\")\n\n// Get 802.1X configuration\nconfig, err := client.GetDot1XConfiguration(ctx, \"config1\")\n\n// Set 802.1X\nerr = client.SetDot1XConfiguration(ctx, config)\n```\n\n#### Relay \u0026 I/O Control\n```go\n// Get relay outputs\nrelays, err := client.GetRelayOutputs(ctx)\n\n// Control relay state\nerr = client.SetRelayOutputState(ctx, \"relay1\", onvif.RelayLogicalStateActive)\nerr = client.SetRelayOutputState(ctx, \"relay1\", onvif.RelayLogicalStateInactive)\n\n// Send auxiliary commands (e.g., IR control)\nresponse, err := client.SendAuxiliaryCommand(ctx, \"tt:IRLamp|On\")\n```\n\n### Full API Reference\n\nFor complete documentation of all 98 Device Management APIs with detailed descriptions, parameters, and return types, see:\n- **[DEVICE_API_STATUS.md](DEVICE_API_STATUS.md)** - Complete API listing with categories and examples\n\n### Media Service\n\n| Method | Description |\n|--------|-------------|\n| `GetProfiles()` | Get all media profiles |\n| `GetStreamURI()` | Get RTSP/HTTP stream URI |\n| `GetSnapshotURI()` | Get snapshot image URI |\n| `GetVideoEncoderConfiguration()` | Get video encoder settings |\n| `GetVideoSources()` | Get all video sources |\n| `GetAudioSources()` | Get all audio sources |\n| `GetAudioOutputs()` | Get all audio outputs |\n| `CreateProfile()` | Create new media profile |\n| `DeleteProfile()` | Delete media profile |\n| `SetVideoEncoderConfiguration()` | Set video encoder configuration |\n\n### PTZ Service\n\n| Method | Description |\n|--------|-------------|\n| `ContinuousMove()` | Start continuous PTZ movement |\n| `AbsoluteMove()` | Move to absolute position |\n| `RelativeMove()` | Move relative to current position |\n| `Stop()` | Stop PTZ movement |\n| `GetStatus()` | Get current PTZ status and position |\n| `GetPresets()` | Get list of PTZ presets |\n| `GotoPreset()` | Move to a preset position |\n| `SetPreset()` | Save current position as preset |\n| `RemovePreset()` | Delete a preset |\n| `GotoHomePosition()` | Move to home position |\n| `SetHomePosition()` | Set current position as home |\n| `GetConfiguration()` | Get PTZ configuration |\n| `GetConfigurations()` | Get all PTZ configurations |\n\n### Imaging Service\n\n| Method | Description |\n|--------|-------------|\n| `GetImagingSettings()` | Get imaging settings (brightness, contrast, etc.) |\n| `SetImagingSettings()` | Set imaging settings |\n| `Move()` | Perform focus move operations |\n| `GetOptions()` | Get available imaging options and ranges |\n| `GetMoveOptions()` | Get available focus move options |\n| `StopFocus()` | Stop focus movement |\n| `GetImagingStatus()` | Get current imaging/focus status |\n\n### Discovery Service\n\n| Method | Description |\n|--------|-------------|\n| `Discover()` | Discover ONVIF devices on network |\n\n## ONVIF Server\n\nThe library now includes a complete ONVIF server implementation that simulates multi-lens IP cameras!\n\n### Quick Start\n\n```bash\n# Install the server CLI\ngo install ./cmd/onvif-server\n\n# Run with default settings (3 camera profiles)\nonvif-server\n\n# Or customize\nonvif-server -profiles 5 -username admin -password mypass -port 9000\n```\n\n### Using the Server Library\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n\n    \"github.com/0x524a/onvif-go/server\"\n)\n\nfunc main() {\n    // Create server with default multi-lens camera configuration\n    srv, err := server.New(server.DefaultConfig())\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // Start server\n    ctx := context.Background()\n    if err := srv.Start(ctx); err != nil {\n        log.Fatal(err)\n    }\n}\n```\n\n### Server Features\n\n- 🎥 **Multi-Lens Simulation**: Support for up to 10 independent camera profiles\n- 🎮 **Full PTZ Control**: Pan, tilt, zoom with preset positions\n- 📷 **Imaging Settings**: Brightness, contrast, exposure, focus, white balance\n- 🌐 **Complete ONVIF Services**: Device, Media, PTZ, and Imaging services\n- 🔐 **WS-Security**: Digest authentication support\n- ⚙️ **Flexible Configuration**: CLI and library interfaces\n\n### Use Cases\n\n- Testing ONVIF client implementations\n- Developing video management systems\n- CI/CD integration testing\n- Demonstrations without physical cameras\n- Learning ONVIF protocol\n\nFor complete documentation, see [server/README.md](server/README.md).\n\n## Examples\n\nThe [examples](examples/) directory contains complete working examples:\n\n### Client Examples\n- **[discovery](examples/discovery/)**: Discover cameras on the network\n- **[device-info](examples/device-info/)**: Get device information and media profiles\n- **[ptz-control](examples/ptz-control/)**: Control camera PTZ (pan, tilt, zoom)\n- **[imaging-settings](examples/imaging-settings/)**: Adjust imaging settings\n\n### Server Examples\n- **[onvif-server](examples/onvif-server/)**: Multi-lens camera server with custom configuration\n\nTo run an example:\n\n```bash\ncd examples/discovery\ngo run main.go\n```\n\n## Architecture\n\n```\nonvif-go/\n├── client.go           # Main ONVIF client\n├── types.go            # ONVIF data types\n├── errors.go           # Error definitions\n├── device.go           # Device service implementation\n├── media.go            # Media service implementation\n├── ptz.go              # PTZ service implementation\n├── imaging.go          # Imaging service implementation\n├── soap/               # SOAP client with WS-Security\n│   └── soap.go\n├── discovery/          # WS-Discovery implementation\n│   └── discovery.go\n├── server/             # ONVIF server implementation\n│   ├── server.go       # Main server\n│   ├── types.go        # Server types and configuration\n│   ├── device.go       # Device service handlers\n│   ├── media.go        # Media service handlers\n│   ├── ptz.go          # PTZ service handlers\n│   ├── imaging.go      # Imaging service handlers\n│   └── soap/           # SOAP server handler\n│       └── handler.go\n├── cmd/\n│   ├── onvif-cli/      # Client CLI tool\n│   └── onvif-server/   # Server CLI tool\n└── examples/           # Usage examples\n    ├── discovery/\n    ├── device-info/\n    ├── ptz-control/\n    ├── imaging-settings/\n    └── onvif-server/   # Multi-lens camera server example\n```\n\n## Design Principles\n\n1. **Context-Aware**: All network operations accept `context.Context` for cancellation and timeouts\n2. **Type Safety**: Strong typing with comprehensive struct definitions\n3. **Error Handling**: Typed errors with clear error messages\n4. **Concurrency Safe**: Thread-safe operations with proper locking\n5. **Performance**: Connection pooling and efficient HTTP client reuse\n6. **Standards Compliant**: Follows ONVIF specifications for SOAP/XML messaging\n\n## Compatibility\n\n- **Go Version**: 1.21+\n- **ONVIF Versions**: Compatible with ONVIF Profile S, Profile T, Profile G\n- **Tested Cameras**: Works with most ONVIF-compliant IP cameras including:\n  - Axis\n  - Hikvision\n  - Dahua\n  - Bosch\n  - Hanwha (Samsung)\n  - And many others\n\n## Testing\n\n```bash\n# Run tests\ngo test ./...\n\n# Run tests with coverage\ngo test -cover ./...\n\n# Run tests with race detection\ngo test -race ./...\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Roadmap\n\n- [ ] Event service implementation\n- [ ] Analytics service implementation\n- [ ] Recording service implementation\n- [ ] Replay service implementation\n- [ ] Advanced security features (TLS, X.509 certificates)\n- [ ] Comprehensive test suite with mock cameras\n- [ ] Performance benchmarks\n- [ ] CLI tool for camera management\n\n## Debugging Tools\n\n### 🔍 Diagnostic Utility\n\nComprehensive camera testing and analysis with optional XML capture:\n\n```bash\ngo build -o onvif-diagnostics ./cmd/onvif-diagnostics/\n\n# Standard diagnostic report\n./onvif-diagnostics \\\n  -endpoint \"http://camera-ip/onvif/device_service\" \\\n  -username \"admin\" \\\n  -password \"pass\" \\\n  -verbose\n\n# With raw SOAP XML capture for debugging\n./onvif-diagnostics \\\n  -endpoint \"http://camera-ip/onvif/device_service\" \\\n  -username \"admin\" \\\n  -password \"pass\" \\\n  -capture-xml \\\n  -verbose\n```\n\n**Generates**:\n- `camera-logs/Manufacturer_Model_Firmware_timestamp.json` - Diagnostic report\n- `camera-logs/Manufacturer_Model_Firmware_xmlcapture_timestamp.tar.gz` - Raw XML (with `-capture-xml`)\n\n**See**: `XML_DEBUGGING_SOLUTION.md` for complete debugging workflow\n\n### 🧪 Camera Test Framework\n\nAutomated regression testing using captured camera responses:\n\n```bash\n# 1. Capture from camera\n./onvif-diagnostics -endpoint \"http://camera/onvif/device_service\" \\\n  -username \"user\" -password \"pass\" -capture-xml\n\n# 2. Generate test\ngo build -o generate-tests ./cmd/generate-tests/\n./generate-tests -capture camera-logs/*_xmlcapture_*.tar.gz -output testdata/captures/\n\n# 3. Run tests\ngo test -v ./testdata/captures/\n```\n\n**Benefits**:\n- Test without physical cameras\n- Prevent regressions across camera models\n- Fast CI/CD integration\n- Real camera response validation\n\n**See**: `testdata/captures/README.md` for complete testing guide\n\n## 🖥️ CLI Tools\n\n### Interactive CLI Tool\n\nFeature-rich command-line interface for camera management and testing:\n\n```bash\ngo build -o onvif-cli ./cmd/onvif-cli/\n\n# Start interactive menu\n./onvif-cli\n```\n\n**Features**:\n- 🔍 Discover cameras on network with interface selection\n- 🌐 View all network interfaces and their capabilities\n- 🔗 Connect to cameras with authentication\n- 📱 Get device info, capabilities, and system settings\n- 📹 Retrieve media profiles and stream URLs\n- 🎮 PTZ control (pan, tilt, zoom, presets)\n- 🎨 Imaging settings (brightness, contrast, exposure, etc.)\n- 📞 Network interface selection for multi-interface systems\n\n**Usage**:\n```\n📋 Main Menu:\n  1. Discover Cameras on Network\n  2. Connect to Camera\n  3. Device Operations\n  4. Media Operations\n  5. PTZ Operations\n  6. Imaging Operations\n  0. Exit\n```\n\nNote: The discovery function now intelligently detects multiple interfaces and shows options only when needed - no separate \"List Network Interfaces\" menu required.\n\n### Quick Demo Tool\n\nLightweight tool for quick testing and demonstration:\n\n```bash\ngo build -o onvif-quick ./cmd/onvif-quick/\n\n# Start interactive menu\n./onvif-quick\n```\n\n**Features**:\n- ⚡ Quick camera discovery\n- 🌐 List available network interfaces\n- 🔗 Quick connection and camera info\n- 🎮 PTZ demo with movement examples\n- 📡 Stream URL retrieval\n\n### Network Interface Selection\n\nThe CLI intelligently handles network interface selection automatically:\n- **Single interface**: Auto-discovery works seamlessly\n- **Multiple interfaces**: Shows interfaces only if auto-discovery fails\n- **Multiple active interfaces**: Tries each one and aggregates results\n\nFor programmatic usage:\n\n```go\nopts := \u0026discovery.DiscoverOptions{\n    NetworkInterface: \"eth0\",  // By interface name\n    // or\n    // NetworkInterface: \"192.168.1.100\",  // By IP address\n}\ndevices, err := discovery.DiscoverWithOptions(ctx, 5*time.Second, opts)\n```\n\n**See**: \n- `docs/CLI_NETWORK_INTERFACE_USAGE.md` - Detailed CLI guide\n- `discovery/NETWORK_INTERFACE_GUIDE.md` - API usage examples\n- `DESIGN_REFACTOR.md` - How smart interface detection works\n\n## 🌟 Star History\n\nIf you find this project useful, please consider giving it a star! ⭐\n\n[![Star History Chart](https://api.star-history.com/svg?repos=0x524a/onvif-go\u0026type=Date)](https://star-history.com/#0x524a/onvif-go\u0026Date)\n\n## 📊 Project Stats\n\n![GitHub repo size](https://img.shields.io/github/repo-size/0x524a/onvif-go)\n![GitHub code size](https://img.shields.io/github/languages/code-size/0x524a/onvif-go)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/0x524a/onvif-go)\n![GitHub last commit](https://img.shields.io/github/last-commit/0x524a/onvif-go)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Inspired by the original [use-go/onvif](https://github.com/use-go/onvif) library\n- ONVIF specifications from [ONVIF.org](https://www.onvif.org)\n- Thanks to all contributors and the Go community\n\n## Support\n\n- 📖 [Documentation](https://pkg.go.dev/github.com/0x524a/onvif-go)\n- 🐛 [Issue Tracker](https://github.com/0x524a/onvif-go/issues)\n- 💬 [Discussions](https://github.com/0x524a/onvif-go/discussions)\n- 🔒 [Security Policy](.github/SECURITY.md)\n\n## Keywords\n\n`onvif` `ip-camera` `surveillance` `golang` `rtsp` `ptz` `camera-control` `video-streaming` `security-camera` `nvr` `vms` `iot` `cctv` `hikvision` `axis` `dahua` `bosch` `camera-sdk` `golang-library` `soap` `ws-discovery`\n\n## Related Projects\n\n- [ONVIF Device Manager](https://sourceforge.net/projects/onvifdm/) - GUI tool for testing ONVIF devices\n- [ONVIF Device Tool](https://www.onvif.org/tools/) - Official ONVIF test tool\n\n---\n\nMade with ❤️ for the Go and IoT community","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x524a%2Fonvif-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x524a%2Fonvif-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x524a%2Fonvif-go/lists"}